Secondary development method and apparatus for target program, and device and storage medium
By generating pre-processing and post-processing interfaces in the target program, the problem of needing to provide source code in existing technologies is solved, enabling secondary development without intruding on the source code, improving development efficiency and protecting intellectual property rights.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- SHANGHAI PARAVIEW SOFTWARE CO LTD
- Filing Date
- 2025-10-13
- Publication Date
- 2026-06-11
AI Technical Summary
The secondary development of existing software requires the provision of source code, and the development and debugging process needs to be compatible with the original code logic, resulting in low intellectual property protection and development efficiency.
By opening the source code of the target program, obtaining key classes and package paths, using enhancement plugins to generate pre-processing and post-processing interfaces, and packaging them into the target software package, secondary development can be achieved.
The secondary development of the target program can be completed without intruding on the source code, which improves development efficiency and protects the intellectual property rights of the source code.
Smart Images

Figure CN2025127334_11062026_PF_FP_ABST
Abstract
Description
A method, apparatus, device, and storage medium for secondary development of a target program.
[0001] This application claims priority to Chinese Patent Application No. 202411752445.5, filed with the Chinese Patent Office on December 2, 2024, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of software development technology, and in particular to a method, apparatus, device and storage medium for secondary development of a target program. Background Technology
[0003] As the demand for secondary development in software development increases, more and more problems arise, such as the need to provide source code and the requirement for compatibility with the original code logic during development and debugging. This is detrimental to the protection of intellectual property rights and development efficiency. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for secondary development of a target program, which enables pre- and post-operations without intruding on the source code, thereby completing the secondary development of the target program, improving development efficiency, and facilitating the protection of source code intellectual property rights.
[0005] According to one aspect of this application, a method for secondary development of a target program is provided, comprising:
[0006] Open the source code of the target program and obtain the key classes in the source code and the package paths corresponding to the key classes;
[0007] The package path is passed as a parameter to the enhancement plugin, which analyzes and processes the key class to generate a pre-processing interface and a post-processing interface.
[0008] The pre-processing interface and the post-processing interface are packaged into the target software package, and the secondary development of the target program is performed based on the target software package.
[0009] In one possible implementation, the key class is the class corresponding to the function to be enhanced in the secondary development of the target program.
[0010] In one possible implementation, opening the source code of the target program and obtaining the key classes in the source code and the package paths corresponding to the key classes includes:
[0011] Open the source code and browse the corresponding project structure to determine the key classes and package paths.
[0012] In one possible implementation, the step of analyzing and processing the key class through the enhancement plugin to generate a pre-processing interface and a post-processing interface includes:
[0013] The enhancement plugin iterates through the key classes under the package path and reads the key classes as byte arrays.
[0014] The byte data is edited using bytecode tools to form the pre-processing interface and the post-processing interface.
[0015] In one possible implementation, the preprocessing interface is the before class corresponding to the key class, and the postprocessing interface is the after class corresponding to the key class.
[0016] In one possible implementation, the target software package includes the native class and the enhanced class corresponding to the target program.
[0017] In one possible implementation, the secondary development of the target program based on the target software package includes:
[0018] In the secondary development project, the target software package is introduced, and a new class is created that inherits the pre-processing interface or the post-processing interface for customized development.
[0019] According to another aspect of this application, a secondary development apparatus for an object program is provided, comprising:
[0020] The acquisition module is used to open the source code of the target program and obtain the key classes in the source code and the package paths corresponding to the key classes;
[0021] The processing module is used to pass the package path as a parameter into the enhancement plugin, and the enhancement plugin analyzes and processes the key class to generate a pre-processing interface and a post-processing interface.
[0022] The development module is used to package the pre-processing interface and the post-processing interface into the target software package, and to perform secondary development of the target program based on the target software package.
[0023] According to another aspect of this application, an electronic device is provided, the electronic device comprising:
[0024] At least one processor;
[0025] and a memory communicatively connected to the at least one processor; wherein,
[0026] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the secondary development method of the target program described in any embodiment of this application.
[0027] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement a secondary development method of the target program described in any embodiment of this application.
[0028] The technical solution of this application includes: opening the source code of the target program and obtaining the key classes and their corresponding package paths; passing the package paths as parameters to an enhancement plugin, analyzing and processing the key classes through the enhancement plugin to generate pre-processing interfaces and post-processing interfaces; packaging the pre-processing interfaces and post-processing interfaces into a target software package, and performing secondary development of the target program based on the target software package. The technical solution of this application discloses that, by editing the bytecode of the key classes of the current system to generate pre- and post-processing interfaces, the secondary development process only requires implementing the interfaces and writing business logic in the corresponding methods. This solves the technical problems in existing software secondary development, such as the need to provide source code and the requirement for compatibility with the original code logic during development and debugging, which are detrimental to intellectual property protection and development efficiency. It achieves pre- and post-processing operations without intruding on the source code, thereby completing the secondary development of the target program, improving development efficiency, and facilitating the protection of source code intellectual property rights.
[0029] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0030] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0031] Figure 1 is a flowchart of a secondary development method for a target program provided in Embodiment 1 of this application;
[0032] Figure 2 is a schematic diagram of the structure of a secondary development device for a target program provided in Embodiment 3 of this application;
[0033] Figure 3 is a schematic diagram of the structure of the electronic device provided in Embodiment 3 of this application. Detailed Implementation
[0034] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0035] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0036] Example 1
[0037] Figure 1 is a flowchart of a secondary development method for a target program provided in Embodiment 1 of this application. This embodiment is applicable to secondary development in software development. The method can be executed by a secondary development device for the target program. This device can be implemented in hardware and / or software and can be configured in a computer device. As shown in Figure 1, the method includes the following steps:
[0038] S110. Open the source code of the target program and obtain the key classes in the source code and the package paths corresponding to the key classes.
[0039] The target program can be a program that requires secondary development.
[0040] In this embodiment of the application, the key class refers to a class in the source code that is important for the functionality that needs to be enhanced. That is, the key class is the class corresponding to the functionality to be enhanced in the secondary development of the target program.
[0041] In this embodiment, the package path is a unique identifier for a class in the project, used to locate the class during compilation and runtime. The location of a key class in the software project can be determined based on the package path.
[0042] [Revised according to Rule 26, 05.11.2025] Specifically, open the source code of the target program and identify the key classes that need to be further developed, as well as the package paths of the key classes. As shown below, this is the source code of the original classes, i.e., the key classes.
[0043] [Revised according to Rule 26, 2005.11.2025]
[0044] In some possible implementations, opening the source code of the target program and obtaining the key classes and their corresponding package paths in the source code includes: opening the source code and browsing the project structure corresponding to the source code to determine the key classes and their package paths.
[0045] S120. Pass the package path as a parameter into the enhancement plugin, and use the enhancement plugin to analyze and process the key class to generate a pre-processing interface and a post-processing interface.
[0046] Among them, an enhancement plugin refers to a specialized tool or plugin that can edit and modify bytecode.
[0047] Specifically, the obtained package path is passed as a parameter to the enhancement plugin, so that the plugin knows which classes need bytecode editing. Then, the critical classes are processed to generate pre-processing and post-processing interfaces.
[0048] In some possible implementations, the step of analyzing and processing the key classes through the enhancement plugin to generate pre-processing interfaces and post-processing interfaces includes: traversing the key classes under the package path through the enhancement plugin and reading the key classes as byte arrays; and editing the byte data using bytecode tools to form the pre-processing interfaces and post-processing interfaces.
[0049] Specifically, the enhancement plugin traverses and analyzes key classes to identify locations where pre- and post-processing logic can be inserted. Then, using bytecode editing technology, it generates pre- and post-processing interfaces at these locations. These interfaces will serve as extension points during secondary development, allowing developers to add new business logic without modifying the original code.
[0050] [Revised according to Rule 26 05.11.2025] For example, as shown in the following code, after obtaining the native class, it is read as a byte array for subsequent editing.
[0051] [Revised according to Rule 26, 05.11.2025] Furthermore, the key class traversal can be analyzed, bytecode edited, and pre- and post-processing interfaces generated. The corresponding code is as follows:
[0052] [Revised according to Rule 26, 2005.11.2025]
[0053] [Revised according to Rule 26, 2005.11.2025]
[0054] In some possible implementations, the preprocessing interface is the before class corresponding to the key class, and the postprocessing interface is the after class corresponding to the key class.
[0055] Specifically, bytecode tools are used to edit the original class files to create new class files, that is, to generate the before class (pre-processing interface) and the after class (post-processing interface).
[0056] [Revised according to Rule 26, 05.11.2025] For example, the code corresponding to the generated before class can be:
[0057] [Revised according to Rule 26, 05.11.2025] For example, the code corresponding to the generated after class could be:
[0058] [Revised according to Rule 26, 2005.11.2025]
[0059] [Revised according to Rule 26, 2005.11.2025]
[0060] S130. Package the pre-processing interface and the post-processing interface into the target software package, and perform secondary development of the target program based on the target software package.
[0061] Specifically, after completing the bytecode editing, the generated interfaces need to be packaged into the final software version. This ensures that secondary developers can directly access and use these interfaces when importing the software package.
[0062] In secondary development projects, a software package containing pre-processing and post-processing interfaces needs to be imported. Developers then need to inherit from these interfaces and implement their own business logic in the corresponding methods. This approach allows developers to achieve customized functional extensions and optimizations without modifying the original software system.
[0063] [Revised according to Rule 26, 05.11.2025] For example, the target software package includes the native class and the enhanced class corresponding to the target program. That is, the generated interface is packaged into the final software package, and in the final software package, the enhanced class and the native class are together. As shown below:
[0064] [Revised according to Rule 26, 2005.11.2025]
[0065] In some possible implementations, the secondary development of the target program based on the target software package includes: introducing the target software package into the secondary development project and creating a new class that inherits the pre-processing interface or the post-processing interface for customized development.
[0066] [Revised according to Rule 26, 05.11.2025] The code corresponding to the software package imported in a secondary development project can be:
[0067] [Revised according to Rule 26, 2005.11.2025]
[0068] For example, inheriting and enhancing interfaces for custom development can include:
[0069] [Revised according to Rule 26, 05.11.2025] Inheriting the `bofore` interface allows for pre-processing operations, and the corresponding code could be:
[0070] [Revised according to Rule 26, 05.11.2025] Inheriting the `after` interface allows for post-processing operations, and the corresponding code could be:
[0071] [Revised according to Rule 26, 2005.11.2025]
[0072] [Revised according to Rule 26, 2005.11.2025]
[0073] As can be seen from the above, without intruding on the source code, pre- and post-operations can be implemented, such as generating serial numbers and storing them in the database beforehand, and printing logs afterward.
[0074] The technical solution of this application includes: opening the source code of the target program and obtaining the key classes and their corresponding package paths; passing the package paths as parameters to an enhancement plugin, analyzing and processing the key classes through the enhancement plugin to generate pre-processing interfaces and post-processing interfaces; packaging the pre-processing interfaces and post-processing interfaces into a target software package, and performing secondary development of the target program based on the target software package. The technical solution of this application discloses that, by editing the bytecode of the key classes of the current system to generate pre- and post-processing interfaces, the secondary development process only requires implementing the interfaces and writing business logic in the corresponding methods. This solves the technical problems in existing software secondary development, such as the need to provide source code and the requirement for compatibility with the original code logic during development and debugging, which are detrimental to intellectual property protection and development efficiency. It achieves pre- and post-processing operations without intruding on the source code, thereby completing the secondary development of the target program, improving development efficiency, and facilitating the protection of source code intellectual property rights.
[0075] Example 2
[0076] Figure 2 is a schematic diagram of a secondary development device for a target program provided in Embodiment 3 of this application. As shown in Figure 2, the device includes:
[0077] The acquisition module 210 is used to open the source code of the target program and acquire the key classes in the source code and the package paths corresponding to the key classes;
[0078] Processing module 220 is used to pass the package path as a parameter into the enhancement plugin, and to analyze and process the key class through the enhancement plugin to generate a pre-processing interface and a post-processing interface.
[0079] The development module 230 is used to package the pre-processing interface and the post-processing interface into the target software package, and to perform secondary development of the target program based on the target software package.
[0080] The technical solution of this application includes: opening the source code of the target program and obtaining the key classes and their corresponding package paths; passing the package paths as parameters to an enhancement plugin, analyzing and processing the key classes through the enhancement plugin to generate pre-processing interfaces and post-processing interfaces; packaging the pre-processing interfaces and post-processing interfaces into a target software package, and performing secondary development of the target program based on the target software package. The technical solution of this application discloses that, by editing the bytecode of the key classes of the current system to generate pre- and post-processing interfaces, the secondary development process only requires implementing the interfaces and writing business logic in the corresponding methods. This solves the technical problems in existing software secondary development, such as the need to provide source code and the requirement for compatibility with the original code logic during development and debugging, which are detrimental to intellectual property protection and development efficiency. It achieves pre- and post-processing operations without intruding on the source code, thereby completing the secondary development of the target program, improving development efficiency, and facilitating the protection of source code intellectual property rights.
[0081] Optionally, the key class is the class corresponding to the function to be enhanced in the secondary development of the target program.
[0082] Optionally, the acquisition module 210 is specifically used for:
[0083] Open the source code and browse the corresponding project structure to determine the key classes and package paths.
[0084] Optionally, the processing module 220 is specifically used for:
[0085] The enhancement plugin iterates through the key classes under the package path and reads the key classes as byte arrays.
[0086] The byte data is edited using bytecode tools to form the pre-processing interface and the post-processing interface.
[0087] Optionally, the preprocessing interface is the before class corresponding to the key class, and the postprocessing interface is the after class corresponding to the key class.
[0088] Optionally, the target software package includes the native class and the enhanced class corresponding to the target program.
[0089] Optionally, the development module 230 is specifically used for:
[0090] In the secondary development project, the target software package is introduced, and a new class is created that inherits the pre-processing interface or the post-processing interface for customized development.
[0091] The secondary development apparatus for the target program provided in this application embodiment can execute the secondary development method of the target program provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects of the execution method.
[0092] Example 3
[0093] Figure 3 is a schematic diagram of the structure of the electronic device provided in Embodiment 3 of this application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or claimed herein.
[0094] As shown in Figure 3, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0095] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0096] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as secondary development methods of the target program.
[0097] In some embodiments, the secondary development method of the target program can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the secondary development method of the target program described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to execute the secondary development method of the target program by any other suitable means (e.g., by means of firmware).
[0098] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0099] Computer programs used to implement the methods of this application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0100] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0101] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the 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 can be received in any form (including sound input, voice input, or tactile input).
[0102] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0103] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0104] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.
[0105] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for secondary development of a target program, comprising: Open the source code of the target program and obtain the key classes in the source code and the package paths corresponding to the key classes; The package path is passed as a parameter to the enhancement plugin, which analyzes and processes the key class to generate a pre-processing interface and a post-processing interface. The pre-processing interface and the post-processing interface are packaged into the target software package, and the secondary development of the target program is performed based on the target software package.
2. The method according to claim 1, wherein, The key class is the class corresponding to the function to be enhanced in the secondary development of the target program.
3. The method according to claim 1, wherein, The step of opening the source code of the target program and obtaining the key classes in the source code and the package paths corresponding to the key classes includes: Open the source code and browse the corresponding project structure to determine the key classes and package paths.
4. The method according to claim 1, wherein, The process of analyzing and processing the key classes through the enhanced plugin to generate pre-processing interfaces and post-processing interfaces includes: The enhancement plugin iterates through the key classes under the package path and reads the key classes as byte arrays. The byte data is edited using bytecode tools to form the pre-processing interface and the post-processing interface.
5. The method according to claim 4, wherein, The preprocessing interface is the before class corresponding to the key class, and the postprocessing interface is the after class corresponding to the key class.
6. The method according to claim 5, wherein, The target software package includes the native class and the enhanced class corresponding to the target program.
7. The method according to claim 1, wherein, The secondary development of the target program based on the target software package includes: In the secondary development project, the target software package is introduced, and a new class is created that inherits the pre-processing interface or the post-processing interface for customized development.
8. A secondary development apparatus for a target program, comprising: The acquisition module is used to open the source code of the target program and obtain the key classes in the source code and the package paths corresponding to the key classes; The processing module is used to pass the package path as a parameter into the enhancement plugin, and the enhancement plugin analyzes and processes the key class to generate a pre-processing interface and a post-processing interface. The development module is used to package the pre-processing interface and the post-processing interface into the target software package, and to perform secondary development of the target program based on the target software package.
9. An electronic device, comprising: At least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to execute the secondary development method of the target program according to any one of claims 1-7.
10. A computer-readable storage medium storing computer instructions, said computer instructions being used to cause a processor to execute a secondary development method for implementing the target program of any one of claims 1-7.