Java class file conflict management method, device, electronic device and medium

By building a JAR package management library and an application information list, and using file encoding and version numbers to manage Java class file conflicts, the problem of class file conflicts between JAR packages was resolved, and the stable operation of Java applications was achieved.

CN113885874BInactive Publication Date: 2024-10-18PING AN BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111158177.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2024-10-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In Java development, class file conflicts between JAR files can cause application crashes, and existing methods cannot effectively resolve class file conflicts when multiple JAR files are called.

Method used

By constructing a list of library information for the JAR package management library, including filenames, file codes, and version numbers, and combining this with the application's program filename and source, duplicate information is removed, and the version number is used to mark the status and delete conflicting class files, thus achieving conflict management for class files.

Benefits of technology

This effectively avoids duplicate conflicts in class files within Java applications, ensuring stable application operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113885874B_ABST
    Figure CN113885874B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of development assistance technology, and discloses a Java class file conflict management method, including: obtaining the file names, file codes and version numbers of multiple class files contained in a jar package in a preset jar package management library, and constructing a library information list; obtaining the file names and sources of class files in all jar packages in a preset application, and obtaining the program file names and program file sources to construct a program information list; removing program file names that do not exist in the program information list, and obtaining a duplicate information list; deduplicating the duplicate information list according to the version number in the library information list, and obtaining a marked information list; removing duplicate class files in the application based on the marked information list, and obtaining a conflict-free application. The present invention also relates to blockchain technology, and the library information list can be stored in a blockchain node. The present invention also proposes a Java class file conflict management device, equipment and storage medium. The present invention can solve the class file conflict problem in Java applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of development assistance technology, and in particular to a Java class file conflict management method, device, electronic device and computer-readable storage medium. Background Art

[0002] When developing a project in Java, there are many things in the code that need to be written repeatedly, which not only wastes the time of code writers, but also easily delays the progress of development. Therefore, jar packages that compress many class files appear. After code writers reference the jar package into the program, they can directly call the class files in the jar package.

[0003] However, in existing jar packages, there are often multiple class files called because the information in each jar package is not interoperable, resulting in class file conflicts, causing the application to crash during the application process. The traditional solution can only traverse the same class files in a jar package. When an application calls multiple jar packages, it will still cause class file conflicts. Summary of the invention

[0004] The present invention provides a Java class file conflict management method, device, electronic device and computer-readable storage medium, the main purpose of which is to solve the class file conflict problem in Java applications.

[0005] To achieve the above object, the present invention provides a Java class file conflict management method, comprising:

[0006] Get the file names of multiple class files contained in the jar package in the preset jar package management library to obtain a file name set;

[0007] Obtaining file codes of the plurality of class files to obtain a file code set, and querying version numbers of the plurality of class files to obtain a version number set;

[0008] Construct a library information list according to the file name set, the file encoding set and the version number set;

[0009] Obtain the file names and sources of class files in all jar packages in a preset application, obtain the program file name and program file source, and construct a program information list according to the program file name and the program file source;

[0010] Remove non-duplicate program file names and corresponding program file sources from the program information list to obtain a duplicate information list;

[0011] Supplementing version numbers for the program file names in the duplicate information list according to the library information list, and using the version numbers to annotate the status of the duplicate information list to obtain an annotated information list;

[0012] Based on the annotation information list, duplicate class files in the application are removed to obtain a conflict-free application.

[0013] Optionally, the acquiring the file codes of the plurality of class files to obtain a file code set includes:

[0014] Using the MessageDigest class to encrypt multiple class files using the MD5 algorithm, to obtain an encrypted data set;

[0015] The encrypted data set is converted into hexadecimal using the Integer class to obtain the file encoding set.

[0016] Optionally, removing non-duplicate program file names and corresponding program file sources in the program information list to obtain a duplicate information list includes:

[0017] Traversing the program information list;

[0018] If the first program file name is not repeated in the program information list, removing the first program file name and the program file source corresponding to the first program file name from the program information list;

[0019] If the second program file name is repeated in the program information list, the repeated second program file name and the corresponding program file source are saved and the program file code of the repeated second program file name is obtained to construct the repeated information list.

[0020] Optionally, the method of supplementing a version number for each program file name in the duplicate information list according to the library information list, and using the version number to mark the status of the duplicate information list to obtain a marked information list includes:

[0021] Obtain all program file names in the duplicate information list, and search for file names corresponding to the program file names in the library information list based on the respective program file names;

[0022] The version number corresponding to each file name is obtained from the library information list, and a behavior status column and a version number column are created for the duplicate information list based on each version number to obtain a marked information list.

[0023] Optionally, creating a behavior status column and a version number column for the duplicate information list based on each version number to obtain a marked information list includes:

[0024] Query the version number corresponding to each program file name in the duplicate information list;

[0025] The behavior status bar corresponding to the program file name with the latest version number is set to be retained, and the rest are set to be deleted, so as to obtain the annotation information list.

[0026] Optionally, removing duplicate class files in the application based on the annotation information list to obtain a conflict-free application includes:

[0027] Traverse the annotation information list, obtain multiple behavior status columns in the annotation information list whose behavior status columns are deletion marks, and obtain program file sources under the same program file name according to the multiple behavior status columns;

[0028] The class files in the application are deleted according to the program file source to obtain the conflict-free application.

[0029] Optionally, after traversing the program information list, the method further includes:

[0030] If all the program file names in the program information list are unique, then there is no Java class file conflict in the application.

[0031] In order to solve the above problem, the present invention also provides a Java class file conflict management device, the device comprising:

[0032] A library list construction module is used to obtain the file names of multiple class files contained in the jar package in the preset jar package management library to obtain a file name set, obtain the file encodings of the multiple class files to obtain a file encoding set, and query the version numbers of the multiple class files to obtain a version number set, and construct a library information list according to the file name set, the file encoding set and the version number set;

[0033] A program list building module is used to obtain the file names and sources of class files in all jar packages in a preset application, obtain the program file names and program file sources, and build a program information list according to the program file names and program file sources;

[0034] A duplicate list building module, used to remove non-duplicate program file names and corresponding program file sources from the program information list to obtain a duplicate information list;

[0035] a marking list construction module, used to add a version number to each program file name in the duplicate information list according to the library information list, and use the version number to mark the status of the duplicate information list to obtain a marking information list;

[0036] The program conflict elimination module is used to eliminate duplicate class files in the application program based on the annotation information list to obtain a conflict elimination application program.

[0037] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:

[0038] at least one processor; and,

[0039] a memory communicatively connected to the at least one processor; wherein,

[0040] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the Java class file conflict management method as described above.

[0041] In order to solve the above problems, the present invention also provides a computer-readable storage medium, including a data storage area and a program storage area, the data storage area stores created data, and the program storage area stores a computer program; wherein, when the computer program is executed by a processor, the Java class file conflict management method as described above is implemented.

[0042] In an embodiment of the present invention, a library information list is created based on the jar package in the jar package management library, and the file name, file code and version number of the class file are provided in the library information list to facilitate intuitive search for the relationship between files. Then, a program file list including the program file source and the program file name is created based on the jar package in the application, and non-duplicate program file names in the program file list are removed to obtain a duplicate information list. Then, the version number is searched in the library file list based on the duplicate program file name, and the conflicting class files in the application are removed through the version number and the program file source, thereby avoiding conflicts between duplicate class files in the Java application. Therefore, the embodiment of the present invention can achieve the purpose of solving the class file conflict problem in Java applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A flowchart of a Java class file conflict management method provided by an embodiment of the present invention;

[0044] Figure 2 A schematic diagram of a module of a Java class file conflict management device provided by an embodiment of the present invention;

[0045] Figure 3 A schematic diagram of the internal structure of an electronic device for implementing a Java class file conflict management method provided by an embodiment of the present invention;

[0046] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0047] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0048] The embodiment of the present application provides a Java class file conflict management method. The execution subject of the Java class file conflict management method includes but is not limited to at least one of the electronic devices such as the server, the terminal, etc. that can be configured to execute the method provided by the embodiment of the present application. Among them, the server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms. In other words, the Java class file conflict management method can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.

[0049] Reference Figure 1 FIG. 1 is a flow chart of a Java class file conflict management method provided by an embodiment of the present invention. In this embodiment, the Java class file conflict management method includes:

[0050] S1. Obtain file names of multiple class files contained in a jar package in a preset jar package management library to obtain a file name set.

[0051] In the embodiment of the present invention, the jar package management library is a database for storing jar packages, wherein all jar packages called in the Java application are stored in the jar package management library.

[0052] In the embodiment of the present invention, the jar package (Java ARchive) is a file package obtained by packaging classes written by other developers. After the jar package is introduced into the existing program, the class files in the jar package can be directly used.

[0053] In the embodiment of the present invention, the class file is a Java class file, which is an 8-bit binary data stream, and is a file obtained after the Java source file passes through the Javac compiler. Each legal class file has a precise definition and can be read and interpreted by the Java virtual machine. Among them, the Java source file consists of a class or external structure, a main method and a written code, and the Java source file can contain multiple classes. The Javac compiler can compile the Java source file into a java bytecode that conforms to the binary specification. The java virtual machine is an abstract computer that runs all java applications and is the operating environment of the java language.

[0054] In the embodiment of the present invention, the file names of all class files in the jar package can be obtained through the getClass function.

[0055] S2. Obtain file codes of the plurality of class files to obtain a file code set, and query version numbers of the plurality of class files to obtain a version number set.

[0056] In the embodiment of the present invention, the file encoding is the encoding of each file of the class obtained by using the MD5 information digest algorithm. The file encoding is an encryption encoding. The integrity and consistency of information transmission can be ensured by the file encoding.

[0057] If the class file is changed, the file encoding will also be changed, and it can be determined by the file encoding whether the class file is modified.

[0058] In the embodiment of the present invention, the step of obtaining the file codes of the plurality of class files to obtain a file code set includes:

[0059] Using the MessageDigest class to encrypt multiple class files using the MD5 algorithm, to obtain an encrypted data set;

[0060] The encrypted data set is converted into hexadecimal using the Integer class to obtain the file encoding set.

[0061] In the embodiment of the present invention, the MessageDigest class is an engine class, which is a native engine class of Java and is designed for applying a secure message digest function on algorithms such as MD5. It can create an encrypted data, i.e., a digest, for the class file.

[0062] Furthermore, the file code in the file code set does not reflect the relevant content of the class file, and the file code is a unique identifier of the class file.

[0063] For example, the file code is 9e236f6d044bcd49469b0aa14d0bc7fd and the version number is 1.9.2.

[0064] In the embodiment of the present invention, the Integer class is used for data base conversion, and is an object used to convert basic data types (such as Java's basic data types: int type data) into object class data. Furthermore, in Java basic data types, if it is not an object, Java methods cannot be obtained, resulting in the inability to perform subsequent operations on the basic data types. Therefore, the Integer class is used to convert basic class data into object class data.

[0065] In the embodiment of the present invention, the MD5 (Message-Digest Algorithm 5) algorithm is an algorithm used to ensure the consistency of information transmission, and has the characteristics of compressibility, easy calculation, anti-modification and strong anti-collision.

[0066] In this embodiment, the version number is the number of each update of the class file.

[0067] S3. Construct a library information list according to the file name set, the file encoding set and the version number set.

[0068] In the embodiment of the present invention, the library information list is an information list constructed with the file encoding of the class file in the jar package management library as the primary key. The primary key is a key used to uniquely identify a record in the library information list, and there is only one primary key without duplication.

[0069] Furthermore, the library information list is shown in Table 1:

[0070] file name File Encoding Version Number org.apache.commons.beanutils.BeanUtils 9e236f6d044bcd49469b0aa14d0bc7fd 1.9.2 org.apache.commons.beanutils.BeanUtils 221212a87c8f987a2f058a718d0ef994 1.8.0 org.apache.logging.log4j.Logger b55b028446764aed45513c1895d147dc 1.2.7 org.apache.logging.log4j.Logger 4fef200cf71a4610ef30180f55c62856 2.2.8

[0071] Table 1

[0072] S4. Obtain the file names and sources of the class files in all jar packages in the preset application, obtain the program file name and the program file source, and construct a program information list according to the program file name and the program file source.

[0073] In the embodiment of the present invention, the application is a Java application.

[0074] In the embodiment of the present invention, the method for extracting the file name of the jar package is the same as that in S1, so it will not be repeated here.

[0075] In this embodiment, for example, the program class file name is org.apache.logging.log4j.Logger, and the source of the program class file is log4j-api-1.2.7.jar.

[0076] In the embodiment of the present invention, the program information list is an information table constructed according to the program file name and the program file source.

[0077] Furthermore, the program information list is shown in Table 2:

[0078] Program file name Program file source org.apache.logging.log4j.Logger log4j-api-1.2.7.jar org.apache.logging.log4j.Logger log4j-core-2.2.8.jar

[0079] Table 2

[0080] S5. Remove non-duplicate program file names and corresponding program file sources from the program information list to obtain a duplicate information list.

[0081] In the embodiment of the present invention, removing non-duplicate program file names and corresponding program file sources in the program information list to obtain the duplicate information list includes:

[0082] Traversing the program information list;

[0083] If the first program file name is not repeated in the program information list, removing the first program file name and the program file source corresponding to the first program file name from the program information list;

[0084] If the second program file name is repeated in the program information list, the repeated second program file name and the corresponding program file source are saved and the program file code of the repeated second program file name is obtained to construct the repeated information list.

[0085] In the embodiment of the present invention, there may be multiple repetitions of the program file name in the program information list, which may be two identical program file names or three or more identical program file names.

[0086] In the embodiment of the present invention, the duplicate information list is a table that only includes the duplicate program file names, program file codes corresponding to the duplicate program file names, and program file sources.

[0087] Furthermore, the repeated information list is shown in Table 3:

[0088] Program file name Program file source Program file encoding org.apache.logging.log4j.Logger log4j-api-1.2.7.jar b55b028446764aed45513c1895d147dc org.apache.logging.log4j.Logger log4j-core-2.2.8.jar 4fef200cf71a4610ef30180f55c62856

[0089] Table 3

[0090] In another embodiment of the present invention, if there is no duplicate program file name in the program information list, there is no Java class file conflict in the application program.

[0091] S6. Supplementing version numbers for the respective program file names in the duplicate information list according to the library information list, and using the version numbers to annotate the status of the duplicate information list to obtain an annotated information list.

[0092] In an embodiment of the present invention, the method of supplementing the version number for each program file name in the duplicate information list according to the library information list, and using the version number to mark the status of the duplicate information list to obtain the marked information list includes:

[0093] Obtain all program file names in the duplicate information list, and search for file names corresponding to the program file names in the library information list based on the respective program file names;

[0094] The version number corresponding to each file name is obtained from the library information list, and the annotation information list is obtained based on the behavior status column and the version number column created for the duplicate information list for each version number.

[0095] In the embodiment of the present invention, for example, in the library information list of Table 1, the file name and the version number are in a one-to-one correspondence.

[0096] In the embodiment of the present invention, the step of creating a behavior status column and a version number column for the duplicate information list based on each version number to obtain the marked information list includes:

[0097] Query the version number corresponding to each program file name in the duplicate information list;

[0098] The behavior status bar corresponding to the program file name with the latest version number is set to be retained, and the rest are set to be deleted, so as to obtain the annotation information list.

[0099] Furthermore, the annotation information list is shown in Table 4:

[0100]

[0101] Table 4

[0102] S7. Remove duplicate class files in the application based on the annotation information list to obtain a conflict-free application.

[0103] In the embodiment of the present invention, the duplicate class files are class files with the same class file names in the application program, and removing the duplicate class files in the application program can resolve application program conflicts.

[0104] In an embodiment of the present invention, removing duplicate class files in the application based on the annotation information list to obtain a conflict-free application includes:

[0105] Traverse the annotation information list, obtain multiple behavior status columns in the annotation information list whose behavior status columns are deletion marks, and obtain program file sources under the same program file name according to the multiple behavior status columns;

[0106] The class files in the application are deleted according to the program file source to obtain the conflict-free application.

[0107] In an embodiment of the present invention, a library information list is created based on the jar package in the jar package management library, and the file name, file encoding and version number of the class file are provided in the library information list to facilitate intuitive search for the relationship between files. Then, a program file list including the program file source and the program file name is created based on the jar package in the application, and non-duplicate program file names in the program file list are removed to obtain a duplicate information list. Then, the version number is searched in the library file list based on the duplicate program file name, and the conflicting class files in the application are removed through the version number and the program file source, thereby avoiding conflicts between duplicate class files in the Java application. Therefore, the embodiment of the present invention can achieve the purpose of Java class file conflict management.

[0108] like Figure 2 FIG. 1 is a schematic diagram of a module of a Java class file conflict management device according to the present invention.

[0109] The Java class file conflict management device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the Java class file conflict management device can include a library list construction module 101, a program list construction module 102, a duplicate list construction module 103, a label list construction module 104 and a program conflict removal module 105. The module of the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.

[0110] In this embodiment, the functions of each module / unit are as follows:

[0111] The library list construction module 101 is used to obtain the file names of multiple class files contained in the jar package in the preset jar package management library to obtain a file name set, obtain the file codes of the multiple class files to obtain a file code set, and query the version numbers of the multiple class files to obtain a version number set, and construct a library information list according to the file name set, the file code set and the version number set;

[0112] The program list building module 102 is used to obtain the file names and sources of the class files in all jar packages in the preset application, obtain the program file names and program file sources, and build a program information list according to the program file names and program file sources;

[0113] The duplicate list building module 103 is used to remove the program file names and corresponding program file sources that are not duplicated in the program information list to obtain a duplicate information list;

[0114] The annotated list construction module 104 is used to add a version number to each program file name in the duplicate information list according to the library information list, and use the version number to annotate the status of the duplicate information list to obtain an annotated information list;

[0115] The program conflict elimination module 105 is used to eliminate duplicate class files in the application based on the annotation information list to obtain a conflict-free application.

[0116] In detail, each module described in the Java class file conflict management device 100 in the embodiment of the present invention adopts the same method as above when used. Figure 1 The Java class file conflict management method described in the above is the same technical means and can produce the same technical effect, which will not be repeated here.

[0117] like Figure 3 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing a Java class file conflict management method according to the present invention.

[0118] The electronic device may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a Java class file conflict management program.

[0119] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (for example, executing a Java class file conflict management program, etc.), and calls data stored in the memory 11 to execute various functions of the electronic device and process data.

[0120] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 can not only be used to store application software and various types of data installed in the electronic device, such as the code of the Java class file conflict management program, but also can be used to temporarily store data that has been output or is to be output.

[0121] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.

[0122] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.

[0123] Figure 3 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 3The structure shown does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0124] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0125] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0126] The Java class file conflict management program stored in the memory 11 in the electronic device is a combination of multiple computer programs. When running in the processor 10, it can achieve:

[0127] Get the file names of multiple class files contained in the jar package in the preset jar package management library to obtain a file name set;

[0128] Obtaining file codes of the plurality of class files to obtain a file code set, and querying version numbers of the plurality of class files to obtain a version number set;

[0129] Construct a library information list according to the file name set, the file encoding set and the version number set;

[0130] Obtain the file names and sources of class files in all jar packages in a preset application, obtain the program file name and program file source, and construct a program information list according to the program file name and the program file source;

[0131] Remove non-duplicate program file names and corresponding program file sources from the program information list to obtain a duplicate information list;

[0132] Supplementing version numbers for the program file names in the duplicate information list according to the library information list, and using the version numbers to annotate the status of the duplicate information list to obtain an annotated information list;

[0133] Based on the annotation information list, duplicate class files in the application are removed to obtain a conflict-free application.

[0134] Specifically, the specific implementation method of the processor 10 for the above computer program can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0135] Furthermore, if the module / unit integrated in the electronic device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).

[0136] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:

[0137] Get the file names of multiple class files contained in the jar package in the preset jar package management library to obtain a file name set;

[0138] Obtaining file codes of the plurality of class files to obtain a file code set, and querying version numbers of the plurality of class files to obtain a version number set;

[0139] Construct a library information list according to the file name set, the file encoding set and the version number set;

[0140] Obtain the file names and sources of class files in all jar packages in a preset application, obtain the program file name and program file source, and construct a program information list according to the program file name and the program file source;

[0141] Remove non-duplicate program file names and corresponding program file sources from the program information list to obtain a duplicate information list;

[0142] Supplementing version numbers for the program file names in the duplicate information list according to the library information list, and using the version numbers to annotate the status of the duplicate information list to obtain an annotated information list;

[0143] Based on the annotation information list, duplicate class files in the application are removed to obtain a conflict-free application.

[0144] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0145] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0146] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0147] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0148] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.

[0149] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0150] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0151] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, but not to indicate any particular order.

[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A Java class file conflict management method, characterized in that: The method comprises: Get the file names of multiple class files contained in the jar package in the preset jar package management library to obtain a file name set; Obtaining file codes of the plurality of class files to obtain a file code set, and querying version numbers of the plurality of class files to obtain a version number set; Construct a library information list according to the file name set, the file encoding set and the version number set; Obtain the file names and sources of class files in all jar packages in a preset application, obtain the program file name and program file source, and construct a program information list according to the program file name and the program file source; Remove non-duplicate program file names and corresponding program file sources from the program information list to obtain a duplicate information list; Supplementing version numbers for the program file names in the duplicate information list according to the library information list, and using the version numbers to annotate the status of the duplicate information list to obtain an annotated information list; Based on the annotation information list, duplicate class files in the application are removed to obtain a conflict-free application; Among them, the method of supplementing the version number for each program file name in the duplicate information list according to the library information list, and using the version number to mark the status of the duplicate information list to obtain the marked information list includes: obtaining all program file names in the duplicate information list, and searching the library information list for the file name corresponding to the program file name based on each program file name; obtaining the version number corresponding to each file name from the library information list, and creating a behavior status bar and a version number bar for the duplicate information list based on each version number to obtain the marked information list.

2. The Java class file conflict management method according to claim 1, characterized in that: The step of obtaining the file codes of the plurality of class files to obtain a file code set includes: Using the MessageDigest class to encrypt multiple class files using the MD5 algorithm, to obtain an encrypted data set; The encrypted data set is converted into hexadecimal using the Integer class to obtain the file encoding set.

3. The Java class file conflict management method according to claim 1, characterized in that: The removing of non-duplicate program file names and corresponding program file sources from the program information list to obtain a duplicate information list includes: Traversing the program information list; If the first program file name is not repeated in the program information list, removing the first program file name and the program file source corresponding to the first program file name from the program information list; If the second program file name is repeated in the program information list, the repeated second program file name and the corresponding program file source are saved and the program file code of the repeated second program file name is obtained to construct the repeated information list.

4. The Java class file conflict management method according to claim 1, characterized in that: The step of creating a behavior status column and a version number column for the duplicate information list based on each version number to obtain a marked information list includes: Query the version number corresponding to each program file name in the duplicate information list; The behavior status bar corresponding to the program file name with the latest version number is set to be retained, and the rest are set to be deleted, so as to obtain the annotation information list.

5. The Java class file conflict management method according to claim 1, characterized in that: The removing duplicate class files in the application based on the annotation information list to obtain a conflict-free application includes: Traverse the annotation information list, obtain multiple behavior status columns in the annotation information list whose behavior status columns are deletion marks, and obtain program file sources under the same program file name according to the multiple behavior status columns; The class files in the application are deleted according to the program file source to obtain the conflict-free application.

6. The Java class file conflict management method according to claim 3, characterized in that: After traversing the program information list, the method further includes: If all the program file names in the program information list are unique, then there is no Java class file conflict in the application.

7. A Java class file conflict management device, used to implement the Java class file conflict management method according to any one of claims 1 to 6, characterized in that: The device comprises: A library list construction module is used to obtain the file names of multiple class files contained in the jar package in the preset jar package management library to obtain a file name set, obtain the file encodings of the multiple class files to obtain a file encoding set, and query the version numbers of the multiple class files to obtain a version number set, and construct a library information list according to the file name set, the file encoding set and the version number set; A program list building module is used to obtain the file names and sources of class files in all jar packages in a preset application, obtain the program file names and program file sources, and build a program information list according to the program file names and program file sources; A duplicate list building module, used to remove non-duplicate program file names and corresponding program file sources from the program information list to obtain a duplicate information list; a marking list construction module, used to add a version number to each program file name in the duplicate information list according to the library information list, and use the version number to mark the status of the duplicate information list to obtain a marking information list; The program conflict elimination module is used to eliminate duplicate class files in the application program based on the annotation information list to obtain a conflict elimination application program.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the Java class file conflict management method according to any one of claims 1 to 6.

9. A computer-readable storage medium, comprising a data storage area and a program storage area, wherein the data storage area stores created data and the program storage area stores a computer program; wherein: When the computer program is executed by a processor, the Java class file conflict management method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Method and device for detecting JAR packet collision

    CN105630463A

  • Rescheduling JIT compilation based on jobs of parallel distributed computing framework

    US20210124600A1