CN113778515B - Method and device for determining program package change information - Google Patents
Method and device for determining program package change information Download PDFInfo
- Publication number
- CN113778515B CN113778515B CN202111316628.9A CN202111316628A CN113778515B CN 113778515 B CN113778515 B CN 113778515B CN 202111316628 A CN202111316628 A CN 202111316628A CN 113778515 B CN113778515 B CN 113778515B
- Authority
- CN
- China
- Prior art keywords
- information
- change
- package
- program
- program package
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- 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)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Stored Programmes (AREA)
Abstract
The disclosure provides a method and a device for determining program package change information, and belongs to the field of computers. The method comprises the following steps: acquiring a plurality of program packages to be compared; analyzing the code file of each program package, and acquiring code description information corresponding to each program package, wherein the code description information at least comprises attribute information and method information corresponding to each class object; constructing a plurality of calling chains corresponding to each program package according to the instruction code information of each class object in each program package; comparing the code description information of each item of the same named class object between the program package of the target version and the program package of the at least one reference version, and determining at least one changed item which is changed; and determining change information corresponding to the target version according to the at least one change item and the plurality of call chains, wherein the change information at least comprises the at least one change item, the corresponding call chain information and the function information. By adopting the method and the device, the function change can be quickly and intuitively known after the version of the program package is updated.
Description
Technical Field
The present disclosure relates to the field of computers, and in particular, to a method and an apparatus for determining package change information.
Background
In the process of program development and management, technicians such as developers, project managers and testers can realize the comparison and management of program codes by referring to the version control software.
The technician can compare the codes of the packages of the current version and the reference version by referring to the version control software to determine the change information between the two. Further, the technician can analyze and manage the package of the current version based on the change information.
However, the above change information generally only includes the changed file and the number of code lines, and a technician can only understand the change lines of the changed file and can only understand the specific functions updated after the code iteration by reading the complicated code file to view the change lines, which results in low efficiency of learning function update.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present disclosure provide a method and an apparatus for determining package change information. The technical scheme is as follows:
according to an aspect of the present disclosure, there is provided a method of determining package change information, the method including:
acquiring a plurality of program packages to be compared, wherein the program packages comprise a program package of a target version and a program package of at least one reference version;
analyzing a code file of each program package to obtain code description information corresponding to each program package, wherein the code description information at least comprises attribute information and method information corresponding to each class object, and the method information comprises instruction code information;
constructing a plurality of calling chains corresponding to each program package according to the instruction code information of each class object in each program package;
comparing each item of code description information of the same named class object between the program package of the target version and the program package of the at least one reference version, and determining at least one changed item which is changed;
and determining change information corresponding to the target version according to the at least one change item and the plurality of call chains, wherein the change information at least comprises the at least one change item and call chain information and function information corresponding to each change item.
According to another aspect of the present disclosure, there is provided an apparatus for determining package change information, the apparatus including:
the device comprises an acquisition module, a comparison module and a comparison module, wherein the acquisition module is used for acquiring a plurality of program packages to be compared, and the program packages comprise a program package of a target version and a program package of at least one reference version;
the analysis module is used for analyzing the code file of each program package and acquiring code description information corresponding to each program package, wherein the code description information at least comprises attribute information and method information corresponding to each class object, and the method information comprises instruction code information;
the building module is used for building a plurality of call chains corresponding to each program package according to the instruction code information of each class object in each program package;
the determining module is used for comparing the code description information of each item of the same named class object between the program package of the target version and the program package of the at least one reference version, and determining at least one changed item which is changed; and determining change information corresponding to the target version according to the at least one change item and the plurality of call chains, wherein the change information at least comprises the at least one change item and call chain information and function information corresponding to each change item.
According to another aspect of the present disclosure, there is provided an electronic device including:
a processor; and
a memory for storing a program, wherein the program is stored in the memory,
wherein the program comprises instructions which, when executed by the processor, cause the processor to perform the above-described method of determining package change information.
According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium storing computer instructions for performing a method of determining package change information.
The technical scheme provided by the disclosure has the following beneficial effects: when the target version is compared with the reference version, the code file in the program package can be analyzed, and the code description information corresponding to each program package is constructed, wherein the code description information can be structured data and at least comprises attribute information and method information corresponding to each class object, and the method information comprises instruction code information. On the basis of the structured data, the instruction code information is conveniently traversed to construct a call chain, each item of code description information of the class objects with the same name is compared, at least one changed item which is changed is determined, and then call chain information and function information influenced by each changed item are determined. Compared with the prior art that version comparison is carried out in a code line checking mode, the technical scheme disclosed by the invention can enable technical personnel to more easily know specific modification carried out in version iteration and call chains and functions of influences, and greatly improves the working efficiency.
Drawings
Further details, features and advantages of the disclosure are disclosed in the following description of exemplary embodiments, taken in conjunction with the accompanying drawings, in which:
fig. 1 illustrates a flowchart of a method of determining program package change information according to an exemplary embodiment of the present disclosure;
FIG. 2 illustrates a code description information diagram according to an exemplary embodiment of the present disclosure;
FIG. 3 shows a byte code file schematic according to an example embodiment of the present disclosure;
FIG. 4 shows a schematic diagram of an apparatus according to an exemplary embodiment of the present disclosure;
FIG. 5 illustrates a call chain diagram according to an exemplary embodiment of the present disclosure;
fig. 6 shows a schematic block diagram of a device for determining program package change information according to an exemplary embodiment of the present disclosure;
FIG. 7 illustrates a block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description. It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
For clarity of description of the methods provided by the embodiments of the present disclosure, the following describes the techniques involved in the present disclosure:
war bag: a program packaging format belongs to Java Web (Java Web page) engineering, is a file format irrelevant to a platform, and can combine a plurality of class files into one file.
Jar package: a program packaging format belongs to Java engineering, is also a file format irrelevant to a platform, and can also combine a plurality of class files into one file.
Byte code file: also referred to as a class file, is typically a Java file that contains the code of the development program. The bytecode file is a file preprocessed by a compiler and is in the form of an execution file of Java, that is, a Java source program (suffixed Java file) needs to be compiled into a platform-independent bytecode file (suffixed class file) before execution. Since the bytecode file is a 16-system file, which is inconvenient to parse directly, in the prior art, when comparing packages of different versions, the comparison is generally performed by parsing the source code, and the bytecode file is not used.
Java file: developers write code files for specific Java functions. Objects with the same properties and functions are abstracted into classes in the Java language, and concrete objects are objects. A class is a carrier of objects, and a particular object in a class may also be referred to as a class object. The class is composed of two parts of an attribute and a method, wherein the attribute is defined according to the characteristics of the class object, and the method is defined according to the behavior of the class object. The method is an execution unit comprising a number of execution statements.
A Controller: generally considered to be the beginning class, the entry of the program, that accepts external requests.
And annotating: a Java technique does not affect the marking mode of program execution.
ASM: a generic Java bytecode manipulation and analysis framework can be used to modify existing bytecode files or dynamically generate bytecode files.
Javaassist: a class library for handling Java bytecodes can be used to modify existing bytecode files or to dynamically generate bytecode files. Javaassist is commonly used for process enhancement.
The disclosed embodiments provide a method for determining package change information, which may be performed by a terminal, a server, and/or other devices with processing capabilities. The method provided by the embodiment of the present disclosure may be implemented by any one of the above devices, or may be implemented by a plurality of devices, for example, the terminal may send a plurality of packages to be compared to the server, and after determining the package change information, the server may return the change information to the terminal.
In this embodiment, a method for specifying package change information is described with reference to a flowchart of a method for specifying package change information shown in fig. 1 by taking a terminal as an example.
Step 101, a terminal acquires a plurality of packages to be compared.
The plurality of packages may include a target version package and at least one reference version package.
In a possible implementation, a developer may write a Java program on a terminal, obtain a package of a current version, and store the package in the terminal. Therefore, a plurality of versions of the package can be stored on the terminal.
In order to clarify the function change among the program packages of different versions, the program packages of different versions need to be compared, at this time, the program packages of different versions to be compared can be selected through the terminal, one of the program packages is used as the program package of the target version, and the rest are used as the program packages of the reference version. For example, when a technician needs a function change between a package comparing a latest version and a history version, the target version may be the latest version and the reference version may be the history version. This embodiment is not limited to this.
And 102, the terminal analyzes the code file of each program package to acquire the code description information corresponding to each program package.
As shown in the code description information diagram of fig. 2, the code description information may be structured data, and at least may include attribute information and method information corresponding to each class object, where the method information may include instruction code information.
In a possible implementation manner, the terminal may use a parsing tool to parse the code file of the package to obtain the attribute information and the method information corresponding to the class object, and the instruction code information in the method information. Furthermore, the terminal can construct the code description information based on the information to obtain the structured code description information.
Optionally, the parsing tool used by the terminal may be javasessist, and the parsed code file may be a bytecode file, which is shown in fig. 3. At this time, the processing of step 102 may be as follows:
reading byte code files under the appointed directory of each program package;
and analyzing the read byte code file to obtain the code description information corresponding to each program package.
In one possible embodiment, the bytecode file may be stored under a designated directory of the package. The terminal can access the specified directory and obtain the corresponding bytecode file. Furthermore, the terminal may call javasessist to read the 16-system bytecode file, traverse the bytecode information therein, and abstract the bytecode information into a class object including methods and attributes, that is, obtain the structured code description information.
In this embodiment, the specific analysis tool is not limited, and for example, the analysis tool may be an ASM or the like.
And 103, the terminal constructs a plurality of call chains corresponding to each program package according to the instruction code information of each class object in each program package.
The instruction code information may include specific operation information, and the operation information may be used to indicate how to construct a call chain corresponding to the package. The operation information may include a method call instruction, an attribute call instruction, and the like. Method invocation instructions include, but are not limited to, invokestatic, invokespecific, invokevirtual, invokeinterface, invokedynamic; attribute invocation information includes, but is not limited to, getfield, getstattic, new, putstattic, getstattic.
In a possible implementation manner, the terminal may traverse the method call instruction and/or the attribute call instruction in the specific instruction code information of each method information in each package, determine a specific call relationship, and further construct a corresponding call chain based on the determined call relationship.
And 104, comparing the code description information of each item of the same named class object between the program package of the target version and the program package of the at least one reference version by the terminal, and determining at least one changed item which is changed.
In a possible implementation manner, the terminal may obtain class objects with the same name in the parsed packages of different versions, and read each item of code description information of the class objects for comparison. Further, code description information with a change is marked as a change item, and the change item is recorded. For example, it can be known which modifications are made to the bytecode file by changing the item, such as adding or deleting a certain method, attribute, and the like.
And 105, the terminal determines the change information corresponding to the target version according to the at least one change item and the plurality of call chains.
The change information at least includes the at least one change item and call chain information and function information corresponding to each change item. The change information may refer to a change of the target version relative to the at least one reference version.
In a possible implementation manner, after determining the modification item, the terminal may search the call chain and the corresponding function affected by the modification item in the call chain, and further, the terminal may integrate the modification item, the call chain information, and the function information to generate corresponding modification information.
The specific procedures for determining the call chain information and the function information are described below.
First, a specific process of determining call chain information may be as follows:
acquiring target method information corresponding to at least one change item;
acquiring at least one target call chain containing target method information from a plurality of call chains corresponding to each program package;
and determining the call chain information corresponding to each change item according to at least one target call chain.
In one possible embodiment, since the change item may include a method or an attribute, the terminal may acquire method information including the change item in the code description information of each package, and for convenience of introduction, the acquired method information is referred to as target method information.
Then, the terminal may traverse the method information in the plurality of call chains obtained in step 103, and may record the corresponding call chain each time the target method information is queried. After the traversal is finished, the terminal can acquire corresponding call chain information for the recorded call chain. The call chain information also refers to the call chain affected by the changed item. For ease of introduction, the call chain affected by the change item is referred to as the target call chain.
Optionally, the change item may affect multiple call chains, and the longest and most complete call chain may be used as the affected link, and the corresponding processing is as follows:
when one change item has a target call chain, taking the call chain information of the target call chain as the call chain information of the corresponding change item;
and when one change item has a plurality of target call chains, taking the call chain information of the target call chain with the largest number of nodes as the call chain information of the corresponding change item.
For example, if a developer performs an operation such as adding, deleting, and modifying a target method, and there are two call chains corresponding to the modified item, as shown in fig. 4, where the call chain 1 includes n nodes, and the call chain 2 includes m nodes, where n > m, the call chain information of the call chain 1 is used as the call information of the corresponding modified item at this time.
Secondly, for the function information, since the call chain may include a plurality of nodes, and the nodes may be method information of the class object, this embodiment provides two possible implementations, and the function information affected by the change item is determined based on the entry node of the call chain.
In a first possible implementation, the name of the entry node of the call chain includes a first character string, and in this case, the process of determining the function information may be: and in each target call chain corresponding to at least one change item, determining the function information corresponding to each change item according to the method information of the entry node. In this embodiment, the application range can be extended without marking the entry node in advance.
For example, when the first character string is the controller, the code file is a byte code file whose file name is the controller end, the character string may be agreed to indicate the start of processing a specific program function, and when the name of the entry node of the call chain includes the character string, it may be known that the specifically changed function is a function indicating the start of processing a specific program function. The present embodiment does not limit the specific first character string.
In a second possible implementation, annotation information may be added to the entry node in advance, and the annotation information of the entry node of the call chain includes the second character string, in this case, the processing of determining the function information may be: and acquiring the function information marked in the annotation information of the entry node in each target call chain corresponding to at least one change item as the function information corresponding to each change item. The annotation information may include function information, and optionally, may also include a degree of importance corresponding to the function information. In this embodiment, the portal node is customized by using specific annotation information, so that the flexibility of marking the portal node can be improved.
For example, when the second string is @ mark, it indicates that the entry node of the call chain is marked by adding a specific annotation @ mark (desc = "function", rank = "1", where desc indicates a function point, and rank marks the importance of the method, default 0 is important, and 1 is minor), and when the packet is compared, if the parsed method information includes the byte code of @ mark, the method is taken as the initial segment of the call chain, and accordingly, the related importance and the specific function marked in the annotation are shown. The present embodiment does not limit the specific second character string.
As shown in the schematic diagram of the change information in fig. 5, after the terminal generates the change information in step 105, the terminal may also display the corresponding change information based on a preset display template. Optionally, the terminal may also display the importance degree corresponding to the function information while displaying the change item. The importance degree may be set in advance by a technician, or may be determined according to the historical use information of the function, for example, the historical use information may be the number of uses, and the importance degree is higher as the number of uses is larger. This embodiment is not limited to this.
In the embodiment of the disclosure, when the current version and the reference version are compared, the change item is determined by analyzing the byte codes in the program packages and constructing one or more call chains corresponding to each program package, and comparing the same class objects among the program packages, and the change information among the versions is determined according to the call chains and the change item, and the specific function corresponding to the change information is indicated. Compared with the prior art that version comparison is carried out in a code line checking mode, the technical scheme disclosed by the invention can enable technical personnel to more easily know specific modification carried out in version iteration and call chains and functions of influences, and greatly improves the working efficiency.
The embodiment of the disclosure provides a device for determining package change information, which is used for implementing the method for determining package change information. As shown in fig. 6, a schematic block diagram of an apparatus for determining package change information 600 includes: the system comprises an acquisition module 601, an analysis module 602, a construction module 603 and a determination module 604.
An obtaining module 601, configured to obtain multiple packages to be compared, where the multiple packages include a package of a target version and a package of at least one reference version;
the analysis module 602 is configured to analyze a code file of each program package, and obtain code description information corresponding to each program package, where the code description information at least includes attribute information and method information corresponding to each class object, and the method information includes instruction code information;
a building module 603, configured to build, according to the instruction code information of each class object in each program package, a plurality of call chains corresponding to each program package;
a determining module 604, configured to compare, between the target version of the package and the at least one reference version of the package, code description information of each item naming a same class object, and determine at least one changed item that is changed; and determining change information corresponding to the target version according to the at least one change item and the plurality of call chains, wherein the change information at least comprises the at least one change item and call chain information and function information corresponding to each change item.
Optionally, the parsing module 602 is configured to:
reading byte code files under the appointed directory of each program package;
and analyzing the read byte code file to obtain the code description information corresponding to each program package.
Optionally, the determining module 604 is configured to:
acquiring target method information corresponding to the at least one change item;
acquiring at least one target call chain containing the target method information from a plurality of call chains corresponding to each program package;
and determining the calling chain information corresponding to each change item according to the at least one target calling chain.
Optionally, the determining module 604 is configured to:
when one change item has a target call chain, taking the call chain information of the target call chain as the call chain information of the corresponding change item;
and when one change item has a plurality of target call chains, taking the call chain information of the target call chain with the largest number of nodes as the call chain information of the corresponding change item.
Optionally, the call chain includes a plurality of nodes, where the node is method information of a class object, and a name of an entry node of the call chain includes a first character string;
the determining module 604 is configured to:
and determining the function information corresponding to each change item in each target call chain corresponding to the at least one change item according to the method information of the entry node.
Optionally, the call chain includes a plurality of nodes, the nodes are method information of class objects, and annotation information of entry nodes of the call chain includes a second character string;
the determining module 604 is configured to:
and acquiring the function information marked in the annotation information of the entry node in each target call chain corresponding to the at least one change item as the function information corresponding to each change item.
Optionally, the building module 603 is configured to:
in each program package, traversing the instruction code information of each class object, and determining the calling relationship between each class object;
and constructing a plurality of calling chains corresponding to each program package according to the calling relation.
In the embodiment of the disclosure, when the target version and the reference version are aligned, the code file in the program package may be analyzed, and the code description information corresponding to each program package may be constructed, where the code description information may be structured data and at least includes attribute information and method information corresponding to each class object, and the method information includes instruction code information. On the basis of the structured data, the instruction code information is conveniently traversed to construct a call chain, each item of code description information of the class objects with the same name is compared, at least one changed item which is changed is determined, and then call chain information and function information influenced by each changed item are determined. Compared with the prior art that version comparison is carried out in a code line checking mode, the technical scheme disclosed by the invention can enable technical personnel to more easily know specific modification carried out in version iteration and call chains and functions of influences, and greatly improves the working efficiency.
An exemplary embodiment of the present disclosure also provides an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor. The memory stores a computer program executable by the at least one processor, the computer program, when executed by the at least one processor, is for causing the electronic device to perform a method according to an embodiment of the disclosure.
The disclosed exemplary embodiments also provide a non-transitory computer readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is adapted to cause the computer to perform a method according to an embodiment of the present disclosure.
Referring to fig. 7, a block diagram of a structure of an electronic device 700, which may be a server or a client of the present disclosure, which is an example of a hardware device that may be applied to aspects of the present disclosure, will now be described. Electronic device is intended to represent various forms of digital electronic computer devices, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 7, the electronic device 700 includes a computing unit 701, which may perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 702 or a computer program loaded from a storage unit 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other by a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
A number of components in the electronic device 700 are connected to the I/O interface 705, including: an input unit 706, an output unit 707, a storage unit 708, and a communication unit 709. The input unit 706 may be any type of device capable of inputting information to the electronic device 700, and the input unit 706 may receive input numeric or character information and generate key signal inputs related to user settings and/or function controls of the electronic device. Output unit 707 may be any type of device capable of presenting information and may include, but is not limited to, a display, speakers, a video/audio output terminal, a vibrator, and/or a printer. Storage unit 708 may include, but is not limited to, magnetic or optical disks. The communication unit 709 allows the electronic device 700 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers and/or chipsets, such as bluetooth devices, WiFi devices, WiMax devices, cellular communication devices, and/or the like.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
As used in this disclosure, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
Claims (10)
1. A method for determining package change information, the method comprising:
acquiring a plurality of program packages to be compared, wherein the program packages comprise a program package of a target version and a program package of at least one reference version;
analyzing a code file of each program package to obtain code description information corresponding to each program package, wherein the code description information at least comprises attribute information and method information corresponding to each class object, and the method information comprises instruction code information;
constructing a plurality of calling chains corresponding to each program package according to the instruction code information of each class object in each program package;
comparing each item of code description information of the same named class object between the program package of the target version and the program package of the at least one reference version, and determining at least one changed item which is changed;
and determining change information corresponding to the target version according to the at least one change item and the plurality of call chains, wherein the change information at least comprises the at least one change item and call chain information and function information corresponding to each change item, and the function information is obtained based on the call chain influenced by the change item.
2. The method for determining package change information according to claim 1, wherein the parsing the code file of each package to obtain the code description information corresponding to each package includes:
reading byte code files under the appointed directory of each program package;
and analyzing the read byte code file to obtain the code description information corresponding to each program package.
3. The method of claim 1, wherein determining the call chain information corresponding to each change item according to the at least one change item and the plurality of call chains comprises:
acquiring target method information corresponding to the at least one change item;
acquiring at least one target call chain containing the target method information from a plurality of call chains corresponding to each program package;
and determining the calling chain information corresponding to each change item according to the at least one target calling chain.
4. The method for determining package change information according to claim 3, wherein the determining call chain information corresponding to each change item according to the at least one target call chain comprises:
when one change item has a target call chain, taking the call chain information of the target call chain as the call chain information of the corresponding change item;
and when one change item has a plurality of target call chains, taking the call chain information of the target call chain with the largest number of nodes as the call chain information of the corresponding change item.
5. The method according to claim 3, wherein the call chain includes a plurality of nodes, the nodes are method information of class objects, and names of entry nodes of the call chain include a first character string;
determining function information corresponding to each change item according to the at least one change item and the plurality of call chains, wherein the function information comprises:
and determining the function information corresponding to each change item in each target call chain corresponding to the at least one change item according to the method information of the entry node.
6. The method according to claim 3, wherein the call chain includes a plurality of nodes, the nodes are method information of class objects, and annotation information of entry nodes of the call chain includes a second character string;
determining function information corresponding to each change item according to the at least one change item and the plurality of call chains, wherein the function information comprises:
and acquiring the function information marked in the annotation information of the entry node in each target call chain corresponding to the at least one change item as the function information corresponding to each change item.
7. The method according to claim 1, wherein the constructing a plurality of call chains corresponding to each package according to the instruction code information of each class object in each package comprises:
in each program package, traversing the instruction code information of each class object, and determining the calling relationship between each class object;
and constructing a plurality of calling chains corresponding to each program package according to the calling relation.
8. An apparatus for determining package change information, the apparatus comprising:
the device comprises an acquisition module, a comparison module and a comparison module, wherein the acquisition module is used for acquiring a plurality of program packages to be compared, and the program packages comprise a program package of a target version and a program package of at least one reference version;
the analysis module is used for analyzing the code file of each program package and acquiring code description information corresponding to each program package, wherein the code description information at least comprises attribute information and method information corresponding to each class object, and the method information comprises instruction code information;
the building module is used for building a plurality of call chains corresponding to each program package according to the instruction code information of each class object in each program package;
the determining module is used for comparing the code description information of each item of the same named class object between the program package of the target version and the program package of the at least one reference version, and determining at least one changed item which is changed; and determining change information corresponding to the target version according to the at least one change item and the plurality of call chains, wherein the change information at least comprises the at least one change item and call chain information and function information corresponding to each change item, and the function information is obtained based on the call chain influenced by the change item.
9. An electronic device, comprising:
a processor; and
a memory for storing a program, wherein the program is stored in the memory,
wherein the program comprises instructions which, when executed by the processor, cause the processor to carry out the method according to any one of claims 1-7.
10. A non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to perform the method of any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111316628.9A CN113778515B (en) | 2021-11-09 | 2021-11-09 | Method and device for determining program package change information |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111316628.9A CN113778515B (en) | 2021-11-09 | 2021-11-09 | Method and device for determining program package change information |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113778515A CN113778515A (en) | 2021-12-10 |
CN113778515B true CN113778515B (en) | 2022-03-04 |
Family
ID=78956841
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111316628.9A Active CN113778515B (en) | 2021-11-09 | 2021-11-09 | Method and device for determining program package change information |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113778515B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116483735B (en) * | 2023-06-21 | 2024-03-19 | 平安银行股份有限公司 | Method, device, storage medium and equipment for analyzing influence of code change |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101458628A (en) * | 2008-12-17 | 2009-06-17 | 浪潮通信信息系统有限公司 | Program edition management method |
CN105159715A (en) * | 2015-09-01 | 2015-12-16 | 南京大学 | Python code change reminding method on basis of abstract syntax tree node change extraction |
CN109460250A (en) * | 2018-09-25 | 2019-03-12 | 平安科技(深圳)有限公司 | A kind of generation method and equipment of application program |
CN112379888A (en) * | 2020-12-02 | 2021-02-19 | 北京皮尔布莱尼软件有限公司 | Code change analysis method |
CN113268245A (en) * | 2021-05-25 | 2021-08-17 | 北京大米科技有限公司 | Code analysis method, device and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1755034B1 (en) * | 2005-08-18 | 2017-01-18 | Telefonaktiebolaget LM Ericsson (publ) | Object code generation for increasing the performance of delta files |
-
2021
- 2021-11-09 CN CN202111316628.9A patent/CN113778515B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101458628A (en) * | 2008-12-17 | 2009-06-17 | 浪潮通信信息系统有限公司 | Program edition management method |
CN105159715A (en) * | 2015-09-01 | 2015-12-16 | 南京大学 | Python code change reminding method on basis of abstract syntax tree node change extraction |
CN109460250A (en) * | 2018-09-25 | 2019-03-12 | 平安科技(深圳)有限公司 | A kind of generation method and equipment of application program |
CN112379888A (en) * | 2020-12-02 | 2021-02-19 | 北京皮尔布莱尼软件有限公司 | Code change analysis method |
CN113268245A (en) * | 2021-05-25 | 2021-08-17 | 北京大米科技有限公司 | Code analysis method, device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113778515A (en) | 2021-12-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110716715B (en) | Application program development method, device, equipment and medium | |
CN110990019B (en) | Java class analysis method and device, storage medium and electronic equipment | |
CN106649084A (en) | Function call information obtaining method and apparatus, and test device | |
US20080288931A1 (en) | Using Dynamic Call Graphs For Creating State Machines | |
CN110737460A (en) | platform project management method and device | |
CN112363695B (en) | PMML file and integration method of runtime environment and industrial software thereof | |
CN112181477A (en) | Complex event processing method and device and terminal equipment | |
CN110515647A (en) | A kind of static resource management method, device, equipment and storage medium | |
CN113568626B (en) | Dynamic packaging and application package opening method and device and electronic equipment | |
CN109947624A (en) | Method for monitoring state and device | |
CN116028028B (en) | Request function generation method, device, equipment and storage medium | |
CN113778515B (en) | Method and device for determining program package change information | |
CN108959294B (en) | Method and device for accessing search engine | |
CN114090365A (en) | Method, device and equipment for performing function test by using dynamic link library | |
CN112069052B (en) | Abnormal object detection method, device, equipment and storage medium | |
CN112965721B (en) | Project compiling method and device based on Android, computer equipment and storage medium | |
EP4075263A1 (en) | Dependency graph generation method and apparatus, device, storage medium, and program product | |
Guarnieri | {GULFSTREAM}: Staged Static Analysis for Streaming {JavaScript} Applications | |
US9064042B2 (en) | Instrumenting computer program code by merging template and target code methods | |
CN112860239A (en) | Data type conversion method and device, electronic equipment and storage medium | |
CN110032394B (en) | Analysis method and device for passive code file and storage medium | |
CN116028108A (en) | Method, device, equipment and storage medium for analyzing dependent package installation time | |
CN115705294B (en) | Method, device, electronic equipment and medium for acquiring function call information | |
CN115269431A (en) | Interface testing method and device, electronic equipment and storage medium | |
CN114115908A (en) | Instruction set generation method, program analysis method, device and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |