Dependency Missing Detection Method, Device, Electronic Device and Storage Medium

By analyzing and comparing the class file list of compressed packages to be detected, the problem that the existing technology cannot accurately check the deep dependence missing of compressed packages is solved, and accurate detection and verification of the dependence missing situations in compressed packages is achieved.

CN115202716BActive Publication Date: 2025-06-20PING AN BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210684844.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-16
Publication Date
2025-06-20
Estimated Expiration
2042-06-16

AI Technical Summary

Technical Problem

The prior art cannot accurately check the deep-level dependency missing situation of compressed packages, such as Jar packages, and cannot effectively determine the dependency missing situation in compressed packages.

Method used

By parsing the compressed package to be detected, obtaining the target class file list and the reference class file list, and comparing it to determine the class comparison results. If there is no actual dependency class file in the target class file list, determine the missing dependency relationship of the compressed package to be detected.

Benefits of technology

Effectively check the deep-level dependency missing situation in the compressed package to be detected, accurately determine the dependency missing situation in compressed packages such as Jar packages, and ensure the integrity and accuracy of the compressed package.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115202716B_ABST
    Figure CN115202716B_ABST
Patent Text Reader

Abstract

The present application provides a method, apparatus, electronic device, and computer-readable storage medium for detecting missing dependencies. The method for detecting missing dependencies includes: parsing a compressed package to be detected to obtain a list of target class files of the compressed package to be detected, where the list of target class files includes class files included in the compressed package to be detected and class files included in the dependency packages of the compressed package to be detected; obtaining a list of reference class files of the compressed package to be detected, where the list of reference class files includes actual dependent class files of the compressed package to be detected; comparing the list of reference class files with the list of target class files to obtain a class comparison result of the compressed package to be detected; and if the class comparison result indicates that there are no actual dependent class files in the list of target class files, determining that the compressed package to be detected has a missing dependency relationship. In the present application, deep-level missing dependency situations in the compressed package to be detected can be checked, so as to accurately determine missing dependency situations in compressed packages such as Jar packages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technologies, and in particular, to a method, apparatus, electronic device, and computer-readable storage medium for detecting missing dependencies. Background Art

[0002] Currently, a large number of enterprises use Java compilation tools for product development. In order to facilitate storage and use, during the process of product development using Java compilation tools, some class files will inevitably be packaged into compressed packages such as Jar packages.

[0003] In the prior art, through the compilation and packaging function of the IDE (Integrated Development Environment), it is checked whether the Jar package is missing dependencies based on whether the packaging is successful, or through functional testing in the test environment to check whether the Jar package is missing dependencies. However, both of these methods cannot check for deep-level missing dependencies and cannot accurately determine the missing dependencies within the Jar package. Summary of the Invention

[0004] The present application provides a method, apparatus, electronic device, and computer-readable storage medium for detecting missing dependencies, aiming to solve the problem in the prior art that deep-level missing dependencies in compressed packages cannot be checked and the missing dependencies within compressed packages such as Jar packages cannot be accurately determined.

[0005] In a first aspect, the present application provides a method for detecting missing dependencies, the method comprising:

[0006] Parsing a compressed package to be detected to obtain a list of target class files of the compressed package to be detected, where the list of target class files includes class files included in the compressed package to be detected and class files included in the dependency packages of the compressed package to be detected;

[0007] Obtaining a list of reference class files of the compressed package to be detected, where the list of reference class files includes actual dependent class files of the compressed package to be detected;

[0008] Comparing the list of reference class files with the list of target class files to obtain a class comparison result of the compressed package to be detected;

[0009] If the class comparison result indicates that the actual dependent class files do not exist in the list of target class files, it is determined that the compressed package to be detected is missing a dependency relationship.

[0010] In a second aspect, the present application provides a device for detecting missing dependencies, the device for detecting missing dependencies comprising:

[0011] A parsing unit for parsing the compression package to be detected to obtain a list of target class files of the compression package to be detected, where the list of target class files includes class files included in the compression package to be detected and class files included in the dependent packages of the compression package to be detected;

[0012] An obtaining unit for obtaining a list of reference class files of the compression package to be detected, where the list of reference class files includes actual dependent class files of the compression package to be detected;

[0013] A comparison unit for comparing the list of reference class files with the list of target class files to obtain a class comparison result of the compression package to be detected;

[0014] A determination unit for determining that the compression package to be detected lacks a dependency relationship if the class comparison result indicates that the actual dependent class file does not exist in the list of target class files.

[0015] In some embodiments, the parsing unit is specifically configured to:

[0016] Parse the compression package to be detected to obtain a first Class file included in the compression package to be detected and a first-level dependent package of the compression package to be detected;

[0017] Parse the first-level dependent package to obtain a second Class file included in the first-level dependent package;

[0018] Until the parsing result of the compression package to be detected does not include a dependent package, summarize to obtain a list of target class files of the compression package to be detected, where the list of class files includes the first Class file and the second Class file.

[0019] In some embodiments, before parsing the compression package to be detected to obtain a list of target class files of the compression package to be detected, the parsing unit is specifically configured to:

[0020] Obtain a Jar package to be released as the compression package to be detected;

[0021] In some embodiments, the dependency missing detection device further includes a publishing unit. After determining that the compression package to be detected lacks a dependency relationship if the class comparison result indicates that the actual dependent class file does not exist in the list of target class files, the publishing unit is specifically configured to:

[0022] Determine a dependency missing object of the compression package to be detected based on the class comparison result;

[0023] Obtain the influence degree of the dependency missing object on the operation of the compression package to be detected;

[0024] If the degree of influence is greater than a preset first influence degree threshold, restrict the automatic release of the compression package to be detected.

[0025] In some embodiments, the detection device for dependency absence further includes a filtering unit, and the filtering unit is specifically configured to:

[0026] Based on the target class file list, detect whether there are at least two identical class files in the same dependency package of the compression package to be detected;

[0027] If there are at least two identical class files in the same dependency package of the compression package to be detected, filter at least two identical class files in the same dependency package to filter redundant files in the same dependency package of the compression package to be detected.

[0028] In some embodiments, the detection device for dependency absence further includes a reminder unit. If the class comparison result indicates that the actual dependency class file does not exist in the target class file list, after determining that the compression package to be detected lacks a dependency relationship, the reminder unit is specifically configured to:

[0029] Determine the dependency absence object of the compression package to be detected based on the class comparison result;

[0030] Obtain the degree of influence of the dependency absence object on the operation of the compression package to be detected;

[0031] If the compression package to be detected has been released and the degree of influence is greater than a preset second influence degree threshold, output a repair reminder for the compression package to be detected.

[0032] In some embodiments, the repair reminder includes the repair urgency and repair difficulty of the compression package to be detected, and the reminder unit is specifically configured to:

[0033] Determine the repair urgency of the compression package to be detected according to the degree of influence, where the degree of influence is in a positive relationship with the repair urgency;

[0034] Obtain the dependency relationship complexity of the dependency absence object and the completeness of the dependency absence object;

[0035] Determine the repair difficulty of the compression package to be detected based on the dependency relationship complexity and the completeness.

[0036] In some embodiments, the obtaining unit is specifically configured to:

[0037] Perform static analysis according to the definitions of the compiled class files of the compression package to be detected to obtain the reference class files of the compiled class files;

[0038] Summarize the reference class files of each of the compiled class files as the actual dependent class files of the compression package to be detected, and obtain the reference class file list of the compression package to be detected.

[0039] In a third aspect, the present application also provides an electronic device, which includes a processor and a memory. A computer program is stored in the memory. When the processor calls the computer program in the memory, it executes the steps in any of the dependency missing detection methods provided by the present application.

[0040] In a fourth aspect, the present application also provides a computer-readable storage medium, on which a computer program is stored. The computer program is loaded by a processor to execute the steps in the dependency missing detection method.

[0041] In the present application, in the first aspect, by parsing the compression package to be detected, a target class file list of the compression package to be detected is obtained. Since the obtained target class file list includes the class files included in the compression package to be detected and the class files included in the dependency package of the compression package to be detected, the deep dependency relationship of the compression package to be detected can be parsed out. In the second aspect, since the reference class file list of the compression package to be detected includes each actual dependent class file of the compression package to be detected, by comparing the reference class file list with the target class file list, a class comparison result of the compression package to be detected is obtained. When the class comparison result indicates that there is no actual dependent class file in the target class file list, it is determined that the compression package to be detected lacks a dependency relationship, and the deep dependency missing situation in the compression package to be detected can be effectively checked, so as to accurately determine the dependency missing situation in a compression package such as a Jar package. Description of the Drawings

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0043] Figure 1 is a schematic diagram of the scenario of the dependency missing detection system provided by the embodiment of the present application;

[0044] Figure 2 is a schematic flowchart of a dependency missing detection method provided by an embodiment of the present application;

[0045] Figure 3 is an exemplary diagram of a dependency missing detection process provided by an embodiment of the present application;

[0046] Figure 4It is a schematic flowchart of an embodiment of step 201 provided in an embodiment of the present application;

[0047] Figure 5 It is a schematic flowchart of an embodiment for restricting the automatic release of the compressed package to be detected provided in an embodiment of the present application;

[0048] Figure 6 It is a schematic flowchart of an embodiment for outputting a repair reminder provided in an embodiment of the present application;

[0049] Figure 7 It is a schematic structural diagram of an embodiment of a detection device for missing dependencies provided in an embodiment of the present application;

[0050] Figure 8 It is a schematic structural diagram of an embodiment of an electronic device provided in an embodiment of the present application. Detailed implementation manners

[0051] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.

[0052] In the description of the embodiments of the present application, it should be understood that the terms "first" and "second" are only used for descriptive purposes, and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of the described features. In the description of the embodiments of the present application, "a plurality" means two or more, unless otherwise specifically defined.

[0053] In order for any person skilled in the art to implement and use the present application, the following description is given. In the following description, details are set forth for purposes of explanation. It should be understood that those of ordinary skill in the art can recognize that the present application can be implemented without using these specific details. In other instances, well-known processes will not be elaborated in detail to avoid unnecessary details from obscuring the description of the embodiments of the present application. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope that conforms to the principles and features disclosed in the embodiments of the present application.

[0054] The execution entity of the method for detecting missing dependencies in the embodiments of the present application can be the device for detecting missing dependencies provided by the embodiments of the present application, or different types of electronic devices such as a server device, a physical host, or a user equipment (UE) integrating the device for detecting missing dependencies. Among them, the device for detecting missing dependencies can be implemented in a hardware or software manner. The UE can specifically be a terminal device such as a smart phone, a tablet computer, a notebook computer, a handheld computer, a desktop computer, or a personal digital assistant (PDA).

[0055] This electronic device can operate independently or in a device cluster mode.

[0056] Refer to Figure 1 , Figure 1 which is a schematic diagram of the scenario of the system for detecting missing dependencies provided by the embodiments of the present application. The system for detecting missing dependencies can include an electronic device 100, and the device for detecting missing dependencies is integrated in the electronic device 100. For example, the electronic device can parse the compression package to be detected to obtain a target class file list of the compression package to be detected, where the target class file list includes the class files included in the compression package to be detected and the class files included in the dependency packages of the compression package to be detected; obtain a reference class file list of the compression package to be detected, where the reference class file list includes each actual dependency class file of the compression package to be detected; compare the reference class file list with the target class file list to obtain a class comparison result of the compression package to be detected; if the class comparison result indicates that the actual dependency class file does not exist in the target class file list, it is determined that the compression package to be detected lacks a dependency relationship.

[0057] In addition, as Figure 1 shown, the system for detecting missing dependencies can further include a memory 200 for storing data, such as storing compression packages such as Jar packages and War packages.

[0058] It should be noted that Figure 1 the schematic diagram of the scenario of the system for detecting missing dependencies shown is only an example. The system for detecting missing dependencies and the scenario described in the embodiments of the present application are for more clearly explaining the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art know that with the evolution of the system for detecting missing dependencies and the emergence of new business scenarios, the technical solutions provided by the embodiments of the present invention are equally applicable to similar technical problems.

[0059] Next, the method for detecting missing dependencies provided by the embodiments of the present application will be introduced. In the embodiments of the present application, an electronic device is used as the execution subject. For the sake of simplicity and convenience of description, the execution subject will be omitted in the subsequent method embodiments.

[0060] Referring to Figure 2 and Figure 3 , Figure 2 is a schematic flowchart of a method for detecting missing dependencies provided by an embodiment of the present application. Figure 3 is a schematic diagram of an embodiment of the process of detecting missing dependencies provided by an embodiment of the present application. It should be noted that although the logical order is shown in the flowchart shown in Figure 2 or other drawings, in some cases, the steps shown or described may be executed in a different order than here. The method for detecting missing dependencies includes steps 201 to 203, where:

[0061] 201. Parse the compressed package to be detected to obtain a list of target class files of the compressed package to be detected.

[0062] Among them, the list of target class files includes the class files included in the compressed package to be detected and the class files included in the dependency package of the compressed package to be detected.

[0063] Among them, the compressed package to be detected refers to a compressed package containing class files for which the dependency relationship is to be detected, such as a Jar package or a War package.

[0064] Among them, the dependency package of the compressed package to be detected is a compressed package containing class files on which the compressed package to be detected depends, such as a Jar package or a War package.

[0065] Among them, the class files included in the compressed package to be detected refer to the class files included in the compressed package to be detected.

[0066] Among them, the class files included in the dependency package of the compressed package to be detected are the class files included in the dependency package of the compressed package to be detected.

[0067] In this article, the compressed package may specifically be a Jar package or a War package, and the specific form of the compressed package may be the compressed package to be detected or the dependency package.

[0068] As Figure 3 shown, before step 201, the user can select a compressed package as the compressed package to be detected from multiple compressed packages, such as from the published compressed packages or from the compressed packages to be automatically published.

[0069] Exemplarily, in order to resolve the deep dependencies in the compressed package, the compressed package to be detected is iteratively parsed until the parsed result no longer contains dependent packages. At this time, in step 201, according to the structure definition of the compressed package to be detected in Java, the Class files contained in this compressed package to be detected and the dependent packages that have been packaged are parsed. Continue to parse these dependent packages to obtain the Class files and dependent packages within the dependent packages. Iterate repeatedly until the parsed result no longer contains dependent packages, then obtain all the Class files within the compressed package to be detected and the dependent packages of the compressed package to be detected, and summarize all the Class files to obtain the target class file list of the compressed package to be detected.

[0070] For example, taking the compressed package to be detected as a Jar package, according to the structure definition of the Jar package to be detected in Java, the Class files contained in this Jar package to be detected and the dependent Jar packages that have been packaged are parsed. Continue to parse these dependent Jar packages to obtain the Class files and dependent Jar packages of the dependent Jar packages. Iterate repeatedly until all the Class files within the Jar package to be detected and the dependent Jar packages of the Jar package to be detected are obtained. Finally, combining the parsed results, summarize all the Class files within the Jar package to be detected and the dependent Jar packages of the Jar package to be detected to obtain the target class file list of the Jar package to be detected.

[0071] In some embodiments, the compressed package to be detected does not contain its dependent packages. At this time, step 201 may specifically include: parsing the compressed package to be detected according to the structure definition of the compressed package to be detected in Java, and directly obtaining all the Class files within the compressed package to be detected. Then, combining the parsed results, summarize all the Class files within the compressed package to be detected to obtain the target class file list of the compressed package to be detected.

[0072] In some embodiments, the compressed package to be detected contains its dependent packages. At this time, as Figure 4 shown, step 201 may specifically include the following steps 2011 to 2013, where:

[0073] 2011. Parse the compressed package to be detected to obtain the first Class files contained in the compressed package to be detected and the first-level dependent packages of the compressed package to be detected.

[0074] Among them, the first Class files refer to the class files contained in the compressed package to be detected obtained by the first parsing of the compressed package to be detected.

[0075] Among them, the first-level dependent packages refer to the compressed packages directly dependent on the compressed package to be detected obtained by the first parsing of the compressed package to be detected.

[0076] Exemplarily, according to the structure definition of the compressed package to be detected in Java, the first parsing is performed on the compressed package to be detected, and the Class files in the compressed package to be retrieved and the dependent packages of the compressed package to be retrieved are obtained. At this time, the Class files in the compressed package to be retrieved obtained by the first parsing are used as the first Class files included in the compressed package to be detected, and the dependent packages in the compressed package to be retrieved obtained by the first parsing are used as the first-level dependent packages of the compressed package to be detected. For example, when performing the first parsing on the Jar package to be retrieved, the Class files of the Jar package to be retrieved and the dependent Jar packages of the Jar package to be retrieved are obtained. The Class files of the Jar package to be retrieved obtained by the first parsing are the first Class files of the Jar package to be retrieved, and the dependent Jar packages of the Jar package to be retrieved obtained by the first parsing are the first-level dependent Jar packages of the Jar package to be retrieved.

[0077] 2012. Parse the first-level dependent packages to obtain the second Class files included in the first-level dependent packages.

[0078] In step 2012, the method of parsing the first-level dependent packages is similar to the method of parsing the compressed package to be detected in step 2011. Specifically, according to the structure definition of the first-level dependent packages in Java, parsing the first-level dependent packages is equivalent to performing the second parsing on the compressed package to be detected, and the Class files in the first-level dependent packages and the dependent packages of the first-level dependent packages are obtained. At this time, the Class files in the first-level dependent packages obtained by the second parsing are used as the second Class files included in the first-level dependent packages, and the dependent packages in the first-level dependent packages obtained by the second parsing are used as the second-level dependent packages of the compressed package to be detected. For example, in step 2011, when performing the first parsing on the Jar package to be retrieved, the first Class files of the Jar package to be retrieved and the first-level dependent Jar packages of the Jar package to be retrieved are obtained; in step 2012, then parsing the first-level dependent Jar packages is equivalent to performing the second parsing on the compressed package to be detected, and the Class files of the first-level dependent Jar packages and the dependent Jar packages of the first-level dependent Jar packages are obtained; at this time, the Class files in the first-level dependent Jar packages obtained by the second parsing are used as the second Class files included in the first-level dependent Jar packages, and the dependent Jar packages in the first-level dependent Jar packages obtained by the second parsing are used as the second-level dependent Jar packages of the Jar package to be retrieved.

[0079] 2013. Until there are no dependent packages in the parsing result of the compressed package to be detected, summarize to obtain the target class file list of the compressed package to be detected.

[0080] Among them, the class file list includes the first Class files and the second Class files.

[0081] When the parsing result of the second parsing of the compressed package to be detected does not contain dependent packages, the first Class files included in the compressed package to be detected obtained from the first parsing and the second Class files included in the first-level dependent packages obtained from the second parsing can be summarized to obtain the target class file list of the compressed package to be detected. At this time, the obtained target class file list includes the class files included in the compressed package to be detected and the class files included in the first-level dependent packages of the compressed package to be detected.

[0082] When the parsing result of the second parsing of the compressed package to be detected contains dependent packages, that is, when the parsing result of the second parsing of the compressed package to be detected contains the dependent packages of the second-level dependent packages (that is, the third-level dependent packages of the compressed package to be detected), according to the structure definition of the second-level dependent packages in Java, the second-level dependent packages are parsed, which is equivalent to performing the third parsing on the compressed package to be detected, and the Class files in the second-level dependent packages and the dependent packages of the second-level dependent packages are parsed. At this time, the Class files in the second-level dependent packages obtained from the third parsing are used as the third Class files included in the second-level dependent packages, and the dependent packages of the second-level dependent packages obtained from the third parsing are used as the third-level dependent packages of the compressed package to be detected. And so on, the third-level, fourth-level,..., n-level dependent packages of the compressed package to be detected are parsed, and the parsed dependent packages are parsed in a loop until the parsing results of the dependent packages no longer contain dependent packages. Then, the first Class files obtained from the first parsing, the second Class files obtained from the second parsing,..., the n Class files obtained from the nth parsing are summarized to obtain the target class file list of the compressed package to be detected. At this time, the obtained target class file list includes the class files included in the compressed package to be detected, the class files included in the first-level dependent packages of the compressed package to be detected, the class files included in the second-level dependent packages,..., the class files included in the n-level dependent packages.

[0083] Taking the compressed package to be detected as the Jar package to be retrieved as an example, the iterative parsing process of steps 2011 to 2013 can be as follows in steps 1) to 3):

[0084] 1) Perform the i = 1st parsing of the compressed package. Specifically, parse the Jar package to be retrieved to obtain the i = 1st class set containing multiple Class files and a Jar dependent package of the Jar package to be retrieved.

[0085] 2) Perform the i = 2 to Nth parsing of the compressed package. Specifically, if the parsing result still contains Jar dependent packages, loop to parse the parsed Jar dependent packages again until after the Nth parsing, the parsing result of the Jar package to be retrieved does not contain Jar dependent packages; at this time, the i = 2 to Nth class sets containing multiple Class files are obtained.

[0086] 3) Aggregate the multiple Class files included in each class set among the i = 1 to N class sets to obtain a list of Class files of the Jar package to be retrieved, which serves as the target class file list of the Jar package to be retrieved.

[0087] 202. Obtain a reference class file list of the compression package to be detected.

[0088] Among them, the reference class file list includes each actual dependent class file of the compression package to be detected.

[0089] Among them, the reference class file list refers to the set of actual dependent class files of the compression package to be detected.

[0090] Among them, the actual dependent class file refers to other Class files referenced by the compiled Class files in Java regarding the compression package to be detected.

[0091] There are multiple ways to obtain the reference class file list in step 202. Exemplarily, it includes:

[0092] (1) Based on the definitions of the compiled class files of the compression package to be detected, perform static analysis in real time. After obtaining each actual dependent class file of the compression package to be detected, aggregate them to obtain the reference class file list in real time. At this time, step 202 can specifically include the following steps 2021 to 2022, where:

[0093] 2021. Perform static analysis according to the definitions of the compiled class files of the compression package to be detected to obtain the reference class files of the compiled class files.

[0094] Among them, the compiled class file refers to the Class file compiled in Java regarding the compression package to be detected.

[0095] 2022. Aggregate the reference class files of the compiled class files as the actual dependent class files of the compression package to be detected to obtain the reference class file list of the compression package to be detected.

[0096] Exemplarily, as Figure 3 shown, according to the definitions of the compiled Class files in Java regarding the compression package to be detected, perform static analysis on it to obtain other Class association information referenced by the compiled Class files. Collect the information of the reference Class files of all Class files and construct a new file list (abbreviated as "dependent Class list"), and this "dependent Class list" can serve as the reference class file list of the compression package to be detected.

[0097] (2) Refer to the real-time construction of the reference class file list in (1) above, and pre-construct the reference class file list of the compression package to be detected and store it in a preset database. In step 202, directly read the reference class file list of the compression package to be detected from the preset database.

[0098] 203. Compare the reference class file list with the target class file list to obtain the class comparison result of the compression package to be detected.

[0099] Among them, the class comparison result is used to indicate whether there are actual dependent class files in the reference file list in the target class file list parsed from the compression package to be detected, and the actual dependent class files missing in the target class file list.

[0100] Exemplarily, as Figure 3 shown, compare the reference class file list and the target class file list, and use the actual dependent class files that exist in the reference class file list but do not exist in the target class file list as the missing dependency objects of the compression package to be detected.

[0101] Among them, the missing dependency object refers to a class file that has a dependency relationship with the class files in the compression package to be detected but is missing in the compression package to be detected.

[0102] For example, the class comparison result can be a set of missing dependency objects. Traverse each actual dependent class file in the reference class file list, compare the currently traversed class file with each class file in the target class file list. If the currently traversed class file does not exist in the target class file list, add the currently traversed class file as a missing dependency object to the class comparison result, and continue to traverse the actual dependent class files in the reference class file list; if the currently traversed class file exists in the target class file list, do not add the currently traversed class file to the class comparison result, and continue to traverse the actual dependent class files in the reference class file list. Loop like this until all the actual dependent class files in the reference class file list are traversed, and obtain the class comparison result of the compression package to be detected. The class files in the class comparison result are the missing dependency objects of the compression package to be detected.

[0103] 204. If the class comparison result indicates that the actual dependent class file does not exist in the target class file list, determine that the compression package to be detected is missing a dependency relationship.

[0104] Exemplarily, if the class comparison result indicates that one or more actual dependent class files in the reference file list do not exist in the target class file list, it can be determined that the actual dependent class file does not exist in the target class file list. At this time, it can be determined that the compression package to be inspected is missing a dependency relationship.

[0105] If the class comparison result indicates that each actual dependent class file in the reference file list exists in the target class file list, it can be determined that the compression package to be inspected does not lack dependencies.

[0106] In some cases, for example, in order to save labor costs, the compression package (such as a Jar package) needs to be automatically released and put online. To avoid the situation of missing dependencies in the compression package, to ensure the integrity and accuracy of the compression package, and to effectively reduce the situation where defects are exposed only after the project or product is put online, improving the quality of the product. Further, before the compression package to be detected is automatically released, it is detected whether there are missing dependencies. After detecting that the compression package to be detected lacks dependencies, the automatic release of the compression package to be detected is restricted. That is, after step 204, the method for detecting missing dependencies can further include: restricting the automatic release of the compression package to be detected.

[0107] Further, since the lack of some dependencies has little impact on the deployment and operation of the compression package to be detected in some cases, in order to more intelligently implement the automatic release and online of the compression package to be detected, it is also possible to combine the impact degree of the lack of dependencies on the operation of the compression package to be detected to determine whether to restrict the automatic release and online of the compression package to be detected. At this time, as Figure 5 shown, "restricting the automatic release of the compression package to be detected" can specifically include the following steps a1 to a3, where:

[0108] a1. Determine the dependency missing object of the compression package to be detected based on the class comparison result.

[0109] Exemplarily, the class comparison result can be a set of dependency missing objects. At this time, the class files in the class comparison result can be read as the dependency missing objects of the compression package to be detected. It can be understood that the class comparison result can include one, two, or more class files. For ease of understanding, in this embodiment, it is assumed that the class comparison result only contains one class file, that is, there is only one dependency missing object, to illustrate how to restrict the automatic release of the compression package to be detected.

[0110] a2. Obtain the impact degree of the dependency missing object on the operation of the compression package to be detected.

[0111] Exemplarily, factors such as the impact scope of the function of the dependency missing object on the function of the compression package to be detected and the importance of the function of the dependency missing object can be combined to determine the impact degree of the dependency missing object on the operation of the compression package to be detected.

[0112] a3. If the impact degree is greater than a preset first impact degree threshold, restrict the automatic release of the compression package to be detected.

[0113] Among them, the specific value of the preset first influence degree threshold can be set according to actual business requirements, and the specific value of the preset first influence degree threshold is not limited here. The difference between the first influence degree threshold and the second influence degree threshold is that: the first influence degree threshold is an influence degree threshold used to indicate whether to restrict the automatic release of the compression package to be detected, and the second influence degree threshold is an influence degree threshold used to indicate whether to output a repair reminder.

[0114] Exemplarily, if the influence degree is greater than the preset first influence degree threshold, it is considered that continuing to automatically release the compression package to be detected will cause defects to be exposed after the project or product is launched, or affect the normal use of the project or product. At this time, the automatic release of the compression package to be detected is restricted. If the influence degree is less than or equal to the preset first influence degree threshold, it is considered that the influence degree of the missing dependent object on the deployment and operation of the compression package to be detected is not large, and the automatic release of the compression package to be detected can still be maintained. Thus, the automatic release of the compression package to be detected can be maintained more intelligently.

[0115] For example, in step 201, the Jar package to be released can be obtained as the compression package to be detected. After detecting and determining that the Jar package to be released has a missing dependency relationship through steps 202 to 204, the influence degree of the missing dependent object of the Jar package to be released on the operation of the Jar package to be released can be detected; if the influence degree of the missing dependent object on the operation of the Jar package to be released is greater than the preset first influence degree threshold, the automatic release of the Jar package to be released is restricted to avoid the situation of missing dependencies in the automatically released Jar package, so as to ensure the integrity and accuracy of the automatically released Jar package, thereby effectively reducing the situation of defects being exposed after the project or product is launched and improving the quality of the product.

[0116] Furthermore, it is also possible to detect the compression package (such as a Jar package) that has been released and launched. In step 201, by obtaining the compression package that has been released and launched as the compression package to be detected, after detecting and determining that the compression package that has been released and launched has a missing dependency relationship through steps 202 to 204, a repair reminder for the compression package that has been released and launched can also be output. As Figure 6 shown, that is, after step 204, the following steps b1 to b3 can further be included, where:

[0117] b1. Determine the missing dependent object of the compression package to be detected based on the class comparison result.

[0118] b2. Obtain the influence degree of the missing dependent object on the operation of the compression package to be detected.

[0119] The implementation of steps b1 to b2 is similar to the above steps a1 to a2, and the specific description can refer to the relevant description of the above steps a1 to a2, which will not be elaborated here.

[0120] b3. If the to-be-detected compressed package has been released and the impact degree is greater than a preset second impact degree threshold, then output a repair reminder for the to-be-detected compressed package.

[0121] Among them, the specific value of the preset second impact degree threshold can be set according to actual business requirements, and the specific value of the preset second impact degree threshold is not limited here. The difference between the first impact degree threshold and the second impact degree threshold is that: the first impact degree threshold is an impact degree threshold used to indicate whether to restrict the automatic release of the to-be-detected compressed package, and the second impact degree threshold is an impact degree threshold used to indicate whether to output a repair reminder.

[0122] Exemplarily, if the to-be-detected compressed package has been released and the impact degree is greater than the preset second impact degree threshold, then output a repair reminder for the to-be-detected compressed package. If the to-be-detected compressed package has been released but the impact degree is less than or equal to the preset second impact degree threshold, then the repair reminder for the to-be-detected compressed package may not be output.

[0123] Among them, the repair reminder is information used to prompt the maintenance personnel to repair the missing dependency relationship of the to-be-detected compressed package, so as to ensure the integrity and accuracy of the compressed package released online again and improve the quality of the product. The repair reminder can specifically be output in the form of voice, text, video, etc., and the specific form of the repair reminder is not limited in this article.

[0124] Exemplarily, the repair reminder may include information such as the repair urgency, repair difficulty, and missing dependency object of the to-be-detected compressed package, for the maintenance personnel to quickly locate and complete the repair of the compressed package according to the repair reminder. At this time, before step b3, the detection method for the missing dependency may further include the following steps c1 to c3 for determining the repair urgency and repair difficulty of the to-be-detected compressed package, where:

[0125] c1. Determine the repair urgency of the to-be-detected compressed package according to the impact degree.

[0126] Among them, the impact degree is in a positive relationship with the repair urgency. That is, the higher the impact degree, the higher the repair urgency; conversely, the lower the impact degree, the lower the repair urgency.

[0127] For example, the value range of the impact degree x is 0 ≤ x ≤ 10. When the impact degree is in the range of 0 ≤ x < 3, the repair urgency is low urgency; when the impact degree is in the range of 3 ≤ x < 7, the repair urgency is medium urgency; when the impact degree is x > 7, the repair urgency is high urgency. If the impact degree determined in step b2 is 6, then the repair urgency of the to-be-detected compressed package can be determined to be medium urgency.

[0128] c2. Obtain the complexity of the dependency relationship of the missing dependency object and the completeness of the missing dependency object.

[0129] Among them, the complexity of the dependency relationship is used to indicate the complexity of the class files on which the missing dependency object depends. Exemplarily, the complexity of the dependency relationship of the missing dependency object can be determined according to the number of class files on which the missing dependency object depends, etc.

[0130] Among them, the completeness is used to indicate whether the missing dependency object is complete and the amount of missing content of the missing dependency object. Exemplarily, the completeness of the missing dependency object can be determined based on whether the missing dependency object is complete, the amount of missing content, etc.

[0131] c3. Based on the complexity of the dependency relationship and the completeness, determine the repair difficulty of the compression package to be detected.

[0132] Among them, the complexity of the dependency relationship is positively correlated with the repair difficulty, that is, the higher the complexity of the dependency relationship, the higher the repair difficulty; conversely, the lower the complexity of the dependency relationship, the lower the repair difficulty.

[0133] Among them, the completeness is inversely correlated with the repair difficulty, that is, the higher the completeness, the lower the repair difficulty; conversely, the lower the completeness, the higher the repair difficulty.

[0134] Exemplarily, first, determine the first repair difficulty of the compression package to be detected according to the complexity of the dependency relationship; then, determine the second repair difficulty of the compression package to be detected according to the completeness; then, according to the preset weight ratio, sum the first repair difficulty and the second repair difficulty, and use the result as the final repair difficulty of the compression package to be detected.

[0135] Furthermore, in order to avoid redundant information in the compression package to be detected, redundant class files in the compression package to be detected or the dependency packages of the compression package to be detected can also be filtered out. For example, based on the target class file list, detect whether there are at least two identical class files in the same dependency package of the compression package to be detected; if there are at least two identical class files in the same dependency package of the compression package to be detected, filter out at least two identical class files in the same dependency package to filter out the redundant files in the same dependency package of the compression package to be detected. Thus, only one of the at least two identical class files in the same dependency package is retained, so as to avoid information redundancy in the same dependency package, and further avoid information redundancy in the compression package to be detected, and simplify the compression package to be detected.

[0136] As can be seen from the above, on the one hand, by parsing the compression package to be detected, a list of target class files of the compression package to be detected is obtained. Since the list of target class files obtained by parsing includes the class files included in the compression package to be detected and the class files included in the dependent packages of the compression package to be detected, the deep dependency relationships of the compression package to be detected can be parsed out. On the other hand, since the reference class file list of the compression package to be detected includes all the actual dependent class files of the compression package to be detected, by comparing the reference class file list with the target class file list, a class comparison result of the compression package to be detected is obtained. When the class comparison result indicates that there are no actual dependent class files in the target class file list, it is determined that the compression package to be detected lacks dependency relationships, and the deep dependency missing situation in the compression package to be detected can be effectively checked, so as to accurately determine the dependency missing situation in compression packages such as Jar packages.

[0137] To better implement the above method, an embodiment of the present application further provides a detection device for dependency missing. The detection device for dependency missing can be specifically integrated in an electronic device, such as a computer device, which can be a terminal, a server, or other devices.

[0138] Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a personal computer, or other devices; the server can be a single server or a server cluster composed of multiple servers.

[0139] For example, in this embodiment, the method of the embodiment of the present application will be described in detail by taking the detection device for dependency missing specifically integrated in a computer as an example.

[0140] For example, as Figure 7 shown, the detection device 700 for dependency missing may include:

[0141] A parsing unit 701, configured to parse the compression package to be detected to obtain a list of target class files of the compression package to be detected, where the list of target class files includes the class files included in the compression package to be detected and the class files included in the dependent packages of the compression package to be detected;

[0142] An obtaining unit 702, configured to obtain a reference class file list of the compression package to be detected, where the reference class file list includes all the actual dependent class files of the compression package to be detected;

[0143] A comparison unit 703, configured to compare the reference class file list with the target class file list to obtain a class comparison result of the compression package to be detected;

[0144] A determination unit 704, configured to determine that the to-be-detected compressed package lacks a dependency relationship if the class comparison result indicates that the actual dependent class file does not exist in the target class file list.

[0145] In some embodiments, the parsing unit 701 is specifically configured to:

[0146] Parse the to-be-detected compressed package to obtain a first Class file included in the to-be-detected compressed package and a first-level dependent package of the to-be-detected compressed package;

[0147] Parse the first-level dependent package to obtain a second Class file included in the first-level dependent package;

[0148] Until the parsing result of the to-be-detected compressed package does not include a dependent package, summarize to obtain a target class file list of the to-be-detected compressed package, where the class file list includes the first Class file and the second Class file.

[0149] In some embodiments, before parsing the to-be-detected compressed package to obtain a target class file list of the to-be-detected compressed package, the parsing unit 701 is specifically configured to:

[0150] Obtain a Jar package to be released as the to-be-detected compressed package;

[0151] In some embodiments, the dependency-missing detection device 700 further includes a publishing unit (not shown in the figure). After determining that the to-be-detected compressed package lacks a dependency relationship if the class comparison result indicates that the actual dependent class file does not exist in the target class file list, the publishing unit is specifically configured to:

[0152] Determine a dependency-missing object of the to-be-detected compression based on the class comparison result;

[0153] Obtain the influence degree of the dependency-missing object on the operation of the to-be-detected compressed package;

[0154] If the influence degree is greater than a preset first influence degree threshold, limit the automatic release of the to-be-detected compressed package.

[0155] In some embodiments, the dependency-missing detection device 700 further includes a filtering unit (not shown in the figure), and the filtering unit is specifically configured to:

[0156] Based on the target class file list, detect whether there are at least two identical class files in the same dependent package of the to-be-detected compressed package;

[0157] If there are at least two identical class files in the same dependent package of the compression package to be detected, filter out at least two identical class files in the same dependent package to filter out redundant files in the same dependent package of the compression package to be detected.

[0158] In some embodiments, the dependency missing detection device 700 further includes a reminder unit (not shown in the figure). After determining that the compression package to be detected is missing a dependency relationship if the class comparison result indicates that the actual dependent class file does not exist in the target class file list, the reminder unit is specifically configured to:

[0159] Determine the dependency missing object of the compression package to be detected based on the class comparison result;

[0160] Obtain the influence degree of the dependency missing object on the operation of the compression package to be detected;

[0161] If the compression package to be detected has been released and the influence degree is greater than a preset second influence degree threshold, output a repair reminder for the compression package to be detected.

[0162] In some embodiments, the repair reminder includes the repair urgency and repair difficulty of the compression package to be detected, and the reminder unit is specifically configured to:

[0163] Determine the repair urgency of the compression package to be detected according to the influence degree, where the influence degree is in a positive relationship with the repair urgency;

[0164] Obtain the dependency relationship complexity and the completeness of the dependency missing object;

[0165] Determine the repair difficulty of the compression package to be detected based on the dependency relationship complexity and the completeness.

[0166] In some embodiments, the obtaining unit 702 is specifically configured to:

[0167] Perform static analysis according to the definitions of the compiled class files of the compression package to be detected to obtain the referenced class files of the compiled class files;

[0168] Summarize the referenced class files of the compiled class files as the actual dependent class files of the compression package to be detected to obtain a reference class file list of the compression package to be detected.

[0169] Accordingly, the detection device 700 for missing dependencies provided by the embodiments of the present application can bring the following technical effects: In the first aspect, by parsing the compressed package to be detected, a list of target class files of the compressed package to be detected is obtained. Since the list of target class files obtained by parsing includes the class files included in the compressed package to be detected and the class files included in the dependency packages of the compressed package to be detected, the deep dependency relationships of the compressed package to be detected can be parsed out. In the second aspect, since the reference class file list of the compressed package to be detected includes the actual dependency class files of the compressed package to be detected, by comparing the reference class file list with the target class file list to obtain the class comparison result of the compressed package to be detected, when the class comparison result indicates that there are no actual dependency class files in the target class file list, it is determined that the compressed package to be detected lacks a dependency relationship, and the deep missing dependency situation in the compressed package to be detected can be effectively detected, so as to accurately determine the missing dependency situation in the compressed package such as a Jar package.

[0170] Correspondingly, the embodiments of the present application further provide an electronic device, which may be a terminal, and the terminal may be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA), and other terminal devices. As Figure 8 shown, Figure 8 is a schematic structural diagram of the electronic device provided by the embodiments of the present application. The electronic device 800 includes a processor 801 with one or more processing cores, a memory 802 with one or more computer-readable storage media, and a computer program stored in the memory 802 and executable on the processor. Among them, the processor 801 is electrically connected to the memory 802. Those skilled in the art can understand that the structural diagram of the electronic device shown in the figure does not constitute a limitation on the electronic device, and it may include more or fewer components than shown in the figure, or combine some components, or have different component arrangements.

[0171] The processor 801 is the control center of the electronic device 800, connecting various parts of the entire electronic device 800 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 802, and by calling the data stored in the memory 802, the processor 801 executes various functions of the electronic device 800 and processes data, so as to monitor the entire electronic device 800.

[0172] In the embodiments of the present application, the processor 801 in the electronic device 800 will load the instructions corresponding to the processes of one or more application programs into the memory 802 according to the following steps, and the processor 801 will run the application programs stored in the memory 802 to implement various functions:

[0173] Parse the compressed package to be detected to obtain a list of target class files of the compressed package to be detected, where the list of target class files includes class files included in the compressed package to be detected and class files included in the dependency packages of the compressed package to be detected;

[0174] Obtain a list of reference class files of the compressed package to be detected, where the list of reference class files includes actual dependent class files of the compressed package to be detected;

[0175] Compare the list of reference class files with the list of target class files to obtain a class comparison result of the compressed package to be detected;

[0176] If the class comparison result indicates that the actual dependent class files do not exist in the list of target class files, it is determined that the compressed package to be detected lacks a dependency relationship.

[0177] For the specific implementation of each of the above operations, reference may be made to the previous embodiments, which will not be elaborated here.

[0178] Therefore, the electronic device 800 provided by the embodiments of the present application can bring the following technical effects: On the one hand, by parsing the compressed package to be detected to obtain a list of target class files of the compressed package to be detected, since the obtained list of target class files includes class files included in the compressed package to be detected and class files included in the dependency packages of the compressed package to be detected, the deep dependency relationship of the compressed package to be detected can be parsed out; on the other hand, since the list of reference class files of the compressed package to be detected includes actual dependent class files of the compressed package to be detected; therefore, by comparing the list of reference class files with the list of target class files to obtain a class comparison result of the compressed package to be detected, when the class comparison result indicates that the actual dependent class files do not exist in the list of target class files, it is determined that the compressed package to be detected lacks a dependency relationship, and the deep dependency missing situation in the compressed package to be detected can be effectively checked, so as to accurately determine the dependency missing situation in a compressed package such as a Jar package.

[0179] Optionally, as Figure 8 shown, the electronic device 800 further includes: a touch display screen 803, a radio frequency circuit 804, an audio circuit 805, an input unit 806, and a power supply 808. Among them, the processor 801 is electrically connected to the touch display screen 803, the radio frequency circuit 804, the audio circuit 805, the input unit 806, and the power supply 807 respectively. Those skilled in the art can understand that Figure 8 the structure of the electronic device shown in

[0180] The touch display screen 803 can be used to display a graphical user interface and receive operation instructions generated by a user's interaction with the graphical user interface. The touch display screen 803 may include a display panel and a touch panel. Among them, the display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, videos, and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. The touch panel can be used to collect touch operations of the user on or near it (such as operations of the user using any suitable object or accessory such as a finger or a stylus on or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute the corresponding program. Optionally, the touch panel can include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the touch position of the user and detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 801, and can receive and execute commands sent by the processor 801. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 801 to determine the type of touch event. Subsequently, the processor 801 provides a corresponding visual output on the display panel according to the type of touch event. In the embodiments of the present application, the touch panel and the display panel can be integrated into the touch display screen 803 to implement input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two independent components to implement input and output functions. That is, the touch display screen 803 can also be used as a part of the input unit 806 to implement the input function.

[0181] The radio frequency circuit 804 can be used to transmit and receive radio frequency signals to establish wireless communication with a network device or other electronic devices through wireless communication, and transmit and receive signals with the network device or other electronic devices.

[0182] The audio circuit 805 can be used to provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 805 can transmit the electrical signal converted from the received audio data to the speaker, and the speaker converts it into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 805 and then converted into audio data. After the audio data is output to the processor 801 for processing, it is transmitted through the radio frequency circuit 804 to, for example, another electronic device, or the audio data is output to the memory 802 for further processing. The audio circuit 805 may also include an earphone jack to provide communication between the peripheral earphone and the electronic device.

[0183] The input unit 806 can be used to receive input digital, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0184] The power supply 808 is used to supply power to each component of the electronic device 800. Optionally, the power supply 808 can be logically connected to the processor 801 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 807 can also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.

[0185] Although Figure 8 not shown in the figure, the electronic device 800 may further include a camera, a sensor, a Wi-Fi module, a Bluetooth module, etc., which will not be elaborated here.

[0186] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0187] As can be seen from the above, the electronic device provided in this embodiment can bring the following technical effects: Since the target index information that can be used to indicate the quality of the business form to be evaluated can be automatically extracted from the target image of the business form to be evaluated, and the quality of the business form to be evaluated is evaluated, it is possible to effectively and quickly evaluate the quality of the business form and improve the quality evaluation efficiency of the business form.

[0188] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling relevant hardware through instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0189] For this reason, an embodiment of the present application provides a computer-readable storage medium, in which multiple computer programs are stored. The computer programs can be loaded by a processor to execute the steps in any one of the dependency missing detection methods provided by the embodiments of the present application. For example, the computer program can execute the following steps:

[0190] Parse the compressed package to be detected to obtain a list of target class files of the compressed package to be detected, where the list of target class files includes class files included in the compressed package to be detected and class files included in the dependency packages of the compressed package to be detected;

[0191] Obtain a reference class file list of the compression package to be detected, where the reference class file list includes each actual dependent class file of the compression package to be detected;

[0192] Compare the reference class file list with the target class file list to obtain a class comparison result of the compression package to be detected;

[0193] If the class comparison result indicates that the actual dependent class file does not exist in the target class file list, it is determined that the compression package to be detected lacks a dependency relationship.

[0194] It can be seen that the computer program can be loaded by a processor to execute the steps in any of the dependency missing detection methods provided by the embodiments of the present application, thereby bringing the following technical effects: On the one hand, by parsing the compression package to be detected, a target class file list of the compression package to be detected is obtained. Since the obtained target class file list includes the class files included in the compression package to be detected and the class files included in the dependency packages of the compression package to be detected, the deep dependency relationship of the compression package to be detected can be parsed out; On the other hand, since the reference class file list of the compression package to be detected includes each actual dependent class file of the compression package to be detected; Therefore, by comparing the reference class file list with the target class file list to obtain a class comparison result of the compression package to be detected, when the class comparison result indicates that the actual dependent class file does not exist in the target class file list, it is determined that the compression package to be detected lacks a dependency relationship, and the deep dependency missing situation in the compression package to be detected can be effectively checked, so as to accurately determine the dependency missing situation in compression packages such as Jar packages.

[0195] For the specific implementation of each of the above operations, reference can be made to the previous embodiments and will not be elaborated here.

[0196] Among them, the computer-readable storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc.

[0197] Since the computer program stored in the computer-readable storage medium can execute the steps in any of the dependency missing detection methods provided by the embodiments of the present application, the beneficial effects that can be achieved by any of the dependency missing detection methods provided by the embodiments of the present application can be realized. For details, refer to the previous embodiments and will not be elaborated here.

[0198] The above has introduced in detail a method, apparatus, electronic device, and computer-readable storage medium for detecting dependency loss provided by the embodiments of the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation on the present application.

Claims

1. A method for detecting dependency absence, characterized in that, The method includes: Parsing the compression package to be detected to obtain a target class file list of the compression package to be detected, where the target class file list includes class files included in the compression package to be detected and class files included in the dependent packages of the compression package to be detected; Obtaining a reference class file list of the compression package to be detected, where the reference class file list includes each actual dependent class file of the compression package to be detected; Comparing the reference class file list with the target class file list to obtain a class comparison result of the compression package to be detected; If the class comparison result indicates that the actual dependent class file does not exist in the target class file list, it is determined that the compression package to be detected lacks a dependency relationship; The parsing the compression package to be detected to obtain a target class file list of the compression package to be detected includes: Parsing the compression package to be detected to obtain a first Class file included in the compression package to be detected and a first-level dependent package of the compression package to be detected; Parsing the first-level dependent package to obtain a second Class file included in the first-level dependent package; Until the parsing result of the compression package to be detected does not include a dependent package, summarizing to obtain a target class file list of the compression package to be detected, where the class file list includes the first Class file and the second Class file; The obtaining a reference class file list of the compression package to be detected includes: Performing static analysis according to the definitions of the compiled class files of the compression package to be detected to obtain the referenced class files of the compiled class files; Summarizing the referenced class files of the compiled class files as the actual dependent class files of the compression package to be detected to obtain a reference class file list of the compression package to be detected.

2. The method for detecting dependency absence according to claim 1, characterized in that, Before the parsing the compression package to be detected to obtain a target class file list of the compression package to be detected, it further includes: Obtaining a Jar package to be released as the compression package to be detected; After the if the class comparison result indicates that the actual dependent class file does not exist in the target class file list, it is determined that the compression package to be detected lacks a dependency relationship, it further includes: Determining a dependency missing object of the compression package to be detected based on the class comparison result; Obtaining the influence degree of the dependency missing object on the operation of the compression package to be detected; If the influence degree is greater than a preset first influence degree threshold, restricting the automatic release of the compression package to be detected.

3. The method for detecting dependency absence according to claim 1, characterized in that, The method further includes: Based on the target class file list, detecting whether there are at least two identical class files in the same dependent package of the compression package to be detected; If there are at least two identical class files in the same dependent package of the compression package to be detected, filtering at least two identical class files in the same dependent package to filter redundant files of the same dependent package of the compression package to be detected.

4. The method for detecting dependency absence according to claim 1, characterized in that, After the if the class comparison result indicates that the actual dependent class file does not exist in the target class file list, it is determined that the compression package to be detected lacks a dependency relationship, it further includes: Determining a dependency missing object of the compression package to be detected based on the class comparison result; Obtain the influence degree of the missing dependency object on the operation of the compressed package to be detected; If the compressed package to be detected has been released and the influence degree is greater than a preset second influence degree threshold, output a repair reminder for the compressed package to be detected.

5. The method for detecting dependency absence according to claim 4, characterized in that, The repair reminder includes the repair urgency and repair difficulty of the compressed package to be detected, and the method further includes: Determine the repair urgency of the compressed package to be detected according to the influence degree, where the influence degree is in a positive relationship with the repair urgency; Obtain the dependency relationship complexity of the missing dependency object and the completeness of the missing dependency object; Based on the dependency relationship complexity and the completeness, determine the repair difficulty of the compressed package to be detected.

6. A device for detecting dependency absence, characterized in that, The detection device for missing dependencies includes: A parsing unit, configured to parse the compressed package to be detected to obtain a target class file list of the compressed package to be detected, where the target class file list includes the class files included in the compressed package to be detected and the class files included in the dependency packages of the compressed package to be detected; An obtaining unit, configured to obtain a reference class file list of the compressed package to be detected, where the reference class file list includes each actual dependency class file of the compressed package to be detected; A comparison unit, configured to compare the reference class file list with the target class file list to obtain a class comparison result of the compressed package to be detected; A determination unit, configured to determine that the compressed package to be detected is missing a dependency relationship if the class comparison result indicates that the actual dependency class file does not exist in the target class file list; The step of parsing the compressed package to be detected to obtain a target class file list of the compressed package to be detected includes: Parse the compressed package to be detected to obtain a first Class file included in the compressed package to be detected and a first-level dependency package of the compressed package to be detected; Parse the first-level dependency package to obtain a second Class file included in the first-level dependency package; Until the parsing result of the compressed package to be detected does not include a dependency package, summarize to obtain a target class file list of the compressed package to be detected, where the class file list includes the first Class file and the second Class file; The step of obtaining a reference class file list of the compressed package to be detected includes: Perform static analysis according to the definitions of the compiled class files of the compressed package to be detected to obtain the reference class files of the compiled class files; Summarize the reference class files of the compiled class files as the actual dependency class files of the compressed package to be detected to obtain a reference class file list of the compressed package to be detected.

7. An electronic device, characterized in that, It includes a processor and a memory, and a computer program is stored in the memory. When the processor calls the computer program in the memory, it executes the method for detecting missing dependencies according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the method for detecting missing dependencies according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and device for detecting robustness of JAVA application program

    CN103559132A

  • Method and device for detecting JAR packet collision

    CN105630463A