File processing method and device and related equipment

By analyzing and storing metadata and relationship information in Java files, it solves the problem that developers find it difficult to obtain development-related information, improves information acquisition efficiency and reduces risks, and ensures the security of the software and the accuracy of information.

CN119512559APending Publication Date: 2025-02-25BEIJING SHANGYIN MICRO CORE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411535147.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

During the computer software development process, it is difficult for developers to obtain development-related information by directly reading the source code, and the software design documents are not updated in time, resulting in mismatch with existing software, affecting optimization, reconstruction and new function development.

Method used

Provides a file processing method, which extracts the metadata and relationship information of elements by obtaining and parsing Java bytecode files or source code files in Java files, and stores them in a database for developers to query.

Benefits of technology

It improves the efficiency of developers to obtain Java information, reduces the risk of source code leakage, and ensures the security of computer software and the timeliness and accuracy of information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512559A_ABST
    Figure CN119512559A_ABST
Patent Text Reader

Abstract

The invention discloses a file processing method and device and related equipment, and the method comprises the steps: obtaining a plurality of Java files to be processed, the plurality of Java files comprising a plurality of Java bytecode files or a plurality of Java source code files; analyzing the plurality of Java files to obtain Java information, the Java information comprising metadata of each element in a plurality of elements included in the plurality of Java files and a relationship among the elements in the plurality of elements; the Java information is stored in a database; obtaining a query request of a user; querying a database according to the query request to obtain a query result corresponding to the query request; and outputting a query result. Therefore, when a developer needs to acquire the Java information, the developer can acquire the required Java information by directly querying the database, so that the developer does not need to download or access all related files, the timeliness and accuracy of the Java information are effectively guaranteed, the efficiency of acquiring the Java information by the developer is improved, the risk of source code leakage is reduced, and the development experience of the developer is improved. And the security of computer software is maintained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a file processing method, device and related equipment. Background Art

[0002] At present, with the development of computer technology, more and more computer software is emerging. When developing computer software, developers usually need to obtain development-related information. For example, developers need to sort out the dependencies between different services in the computer software and the call links and other information in order to optimize, reconstruct or develop new functions for the computer software.

[0003] In actual scenarios, due to the diversity of source code writing styles, it is difficult for developers to obtain development-related information by directly reading the source code. Therefore, developers can use the software design documents recorded during the development process to obtain the required information. However, in the long development process of computer software, the turnover of developers and the failure to update software design documents in a timely manner will cause the software design documents to be mismatched with the existing computer software, seriously affecting the optimization, reconstruction and development of new functions of computer software.

[0004] In the Java development environment, developers can quickly sort out development-related information with the help of development tools in the Integrated Development Environment (IDE) without software design documents. For example, developers can use the development tools in the IDE to sort out the situations in which classes, methods, properties and other elements in computer software are called or referenced. However, using the development tools in the IDE to obtain development-related information often involves risks and is not very effective. Summary of the invention

[0005] The embodiment of the present application provides a file processing method to avoid the risk of leakage of computer software related development files and improve the efficiency of developers in obtaining Java information. In addition, the embodiment of the present application also provides a corresponding file processing device, a computing device, a computer-readable storage medium and a computer program product.

[0006] In a first aspect, an embodiment of the present application provides a file processing method, comprising: obtaining multiple Java files to be processed, the multiple Java files including multiple Java bytecode files or multiple Java source code files; parsing the multiple Java files to obtain Java information, the Java information including metadata of each element among multiple elements included in the multiple Java files and the relationship between each element among the multiple elements; storing the Java information in a database; obtaining a user's query request; querying the database according to the query request to obtain a query result corresponding to the query request; and outputting the query result.

[0007] In a possible implementation, the multiple Java files are multiple Java bytecode files, and parsing the multiple Java files includes: parsing the multiple Java bytecode files according to a bytecode engineering library BCEL.

[0008] In a possible implementation, the multiple Java files are multiple Java source code files, and parsing the multiple Java files includes: parsing the multiple Java source code files according to a Java abstract syntax tree (AST) parser.

[0009] In a possible implementation, obtaining multiple Java files to be processed includes: obtaining at least one Java source file to be processed, each Java source file in the at least one Java source file being a Java project file or a Java archive JAR file; and reading the multiple Java files from the at least one Java source file.

[0010] In a possible implementation, the query request is a traffic entry for a first method, the first method is an element in the database, and the database is queried according to the query request to obtain a query result corresponding to the query request, including: according to the query request, querying multiple methods in the database that call the first method, and the multiple methods are not called by any method in the database, to obtain metadata of the multiple methods.

[0011] In a possible implementation, the query request is an influencing method of a second method, the second method is an element in the database, and the database is queried according to the query request to obtain a query result corresponding to the query request, including: according to the query request, querying multiple methods called by the second method in the database to obtain metadata of the multiple methods.

[0012] In one possible implementation, the query request is a lineage view of a third method, and the third method is an element in the database. According to the query request, the database is queried to obtain a query result corresponding to the query request, including: according to the query request, multiple methods in the database that call the third method are queried to obtain the lineage view, wherein the lineage view includes the third method and the multiple methods, and the third method and each of the multiple methods are connected by directed edges, and the direction of the directed edges points to the called method.

[0013] In a possible implementation, the query request is an impact view of a fourth method, and the fourth method is an element in the database. According to the query request, the database is queried to obtain a query result corresponding to the query request, including: according to the query request, multiple methods called by the fourth method in the database are queried to obtain the impact view, and the impact view includes the fourth method and the multiple methods, the fourth method and each method in the multiple methods are connected by a directed edge, and the direction of the directed edge points to the called method, and the query result is the impact view.

[0014] In a second aspect, an embodiment of the present application provides a file processing device, including: an acquisition module, the acquisition module is used to acquire multiple Java files to be processed, the multiple Java files include multiple Java bytecode files or multiple Java source code files; the acquisition module is also used to acquire a user's query request; a parsing module, the parsing module is used to parse the multiple Java files to obtain Java information, the Java information includes metadata of each element in the multiple elements in the multiple Java files and the relationship between each element in the multiple elements; a storage module, the storage module is used to store the Java information in a database; a query module, the query module is used to query the database according to the query request to obtain a query result corresponding to the query request; and an output module, the output module is used to output the query result.

[0015] In a possible implementation, the multiple Java files are multiple Java bytecode files, and the parsing module is specifically used to parse the multiple Java bytecode files according to the bytecode engineering library BCEL.

[0016] In a possible implementation, the multiple Java files are multiple Java source code files, and the parsing module is specifically used to parse the multiple Java source code files according to a Java abstract syntax tree AST parser.

[0017] In a possible implementation, the acquisition module is specifically used to: acquire at least one Java source file to be processed, each Java source file in the at least one Java source file is a Java project file or a Java archive JAR file; and read the multiple Java files from the at least one Java source file.

[0018] In a possible implementation, the query request is a traffic entry of a first method, the first method is an element in the database, and the query module is specifically used to: query multiple methods in the database that call the first method according to the query request, and the multiple methods are not called by any method in the database, and obtain metadata of the multiple methods.

[0019] In a possible implementation, the query request is an influencing method of a second method, the second method is an element in the database, and the query module is specifically used to: query multiple methods called by the second method in the database according to the query request, and obtain metadata of the multiple methods.

[0020] In one possible implementation, the query request is a lineage view of a third method, and the third method is an element in the database. The query module is specifically used to: query multiple methods in the database that call the third method according to the query request to obtain the lineage view, and the lineage view includes the third method and the multiple methods. The third method and each of the multiple methods are connected by directed edges, and the direction of the directed edges points to the called method.

[0021] In a possible implementation, the query request is an impact view of a fourth method, and the fourth method is an element in the database. The query module is specifically used to: query multiple methods called by the fourth method in the database according to the query request to obtain the impact view, and the impact view includes the fourth method and the multiple methods. The fourth method and each method in the multiple methods are connected by directed edges, and the direction of the directed edges points to the called method. The query result is the impact view.

[0022] In a third aspect, an embodiment of the present application further provides a computing device, which may include a processor and a memory:

[0023] The memory is used to store computer programs;

[0024] The processor is used to execute the method described in the first aspect and any one of the embodiments of the first aspect according to the computer program.

[0025] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method described in the first aspect and any one of the implementation methods of the first aspect.

[0026] In a fifth aspect, an embodiment of the present application further provides a computer program product comprising instructions, which, when executed on a computing device, enables the computing device to execute the method described in the first aspect and any one of the implementations of the first aspect.

[0027] In the above implementation of the embodiment of the present application, multiple Java files to be processed are obtained, and the multiple Java files include multiple Java bytecode files or multiple Java source code files; multiple Java files are parsed to obtain Java information, and the Java information includes metadata of each element in multiple elements included in multiple Java files and the relationship between each element in multiple elements; Java information is stored in a database; a user's query request is obtained; according to the query request, the database is queried to obtain the query result corresponding to the query request; and the query result is output. In this way, multiple Java files are parsed, and the Java information obtained by parsing is stored in a database. In this way, when developers need to obtain Java information, they can obtain the Java information required by developers by directly querying the database, thereby meeting the query needs of developers, so that developers can obtain the required Java information without downloading or accessing all related files, thereby improving the efficiency of developers in obtaining Java information, effectively reducing the risk of source code leakage, and maintaining the security of computer software. In addition, for Java bytecode files and Java source code files existing in the Java development environment, Java information can be obtained by parsing, which reduces the problem of incomplete Java information parsing compared to using the development tools in the IDE to parse related codes, and Java files match existing computer software, effectively ensuring the timeliness and accuracy of Java information. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0029] Figure 1 This is a schematic diagram of the architecture of a file processing system in an embodiment of the present application;

[0030] Figure 2 A flowchart of a file processing method in an embodiment of the present application;

[0031] Figure 3 A schematic diagram of metadata of an element and the relationship between the elements in an embodiment of the present application;

[0032] Figure 4 A schematic diagram of metadata of another element and the relationship between the elements in an embodiment of the present application;

[0033] Figure 5 A schematic diagram of a file processing software in an embodiment of the present application;

[0034] Figure 6 A schematic diagram of an application of a file processing software in an embodiment of the present application;

[0035] Figure 7 A schematic diagram of the relationship between elements in an embodiment of the present application;

[0036] Figure 8 A schematic diagram of another application of file processing software in an embodiment of the present application;

[0037] Fig. 9 A schematic diagram of another application of file processing software in an embodiment of the present application;

[0038] Fig.10 A schematic diagram of another application of file processing software in an embodiment of the present application;

[0039] Fig.11 A schematic diagram of another application of file processing software in an embodiment of the present application;

[0040] Fig.12 This is a schematic diagram of the structure of a file processing device in an embodiment of the present application;

[0041] Fig.13 A schematic diagram of the hardware structure of a computing device in an embodiment of the present application. DETAILED DESCRIPTION

[0042] See also Figure 1 , is a schematic diagram of the architecture of a file processing system provided by this application. Figure 1 As shown, the file processing system 10 includes a processor 100, a database 200, and at least one memory. Figure 1 The memory 301 and the memory 302 are taken as an example. In actual application scenarios, the file processing system 10 may include any number of memories.

[0043] The processor 100 and the database 200, the memory 301 or the memory 302 may be connected via a bus, which may be, for example, a peripheral component interconnect express (PCIE) bus, etc. The processor 100 and the database 200, the memory 301 or the memory 302 may also be connected via a network, which may be, for example, a local area network (LAN), a wide area network (WAN), etc. in terms of coverage, and may be, for example, a wired network or a wireless network, etc. in terms of connection mode.

[0044] The processor 100 refers to a device with data processing and control capabilities, such as a central processing unit (CPU), a microprocessor (MPU), etc., or an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), etc., without limitation.

[0045] The database 200 refers to a device with data storage, management and query capabilities, and may be, for example, a relational database such as MySQL, or a graph database such as Neo4j, without limitation.

[0046] The memory 301 (similar to the memory 302 ) refers to a device having a file storage capability, and may be, for example, a semiconductor memory, a magnetic memory, an optical memory, etc., but is not limited thereto.

[0047] In actual application scenarios, during the process of computer software development, developers often need to obtain information related to computer software development, so as to facilitate the optimization, reconstruction or development of new functions of the computer software. For example, in a distributed microservice architecture, developers can implement stress testing and regression testing of computer software based on the dependencies and call links between services.

[0048] Generally speaking, developers can obtain the required development-related information based on software design documents. However, in the long software development cycle, changes in developers and failure to update software design documents in a timely manner often lead to the phenomenon that software design documents are not compatible with the current computer software, which in turn has a significant impact on software optimization, reconstruction and new function development.

[0049] In a Java development environment, developers can also use the development tools in the IDE to sort out the required Java information. For example, developers can use the development tools to sort out the situations in which elements such as classes, methods, and properties in computer software are called or referenced. However, when developers intend to use development tools to obtain complete Java information, they cannot avoid the need to obtain the complete source code files or Jar files of the computer software, which greatly increases the risk of file leakage related to computer software development.

[0050] Based on this, the processor 100 can obtain multiple Java files to be processed, wherein the multiple Java files include multiple Java bytecode files or multiple Java source code files; then, the processor 100 can parse the multiple Java files to obtain Java information, for example, the processor 100 can parse multiple Java bytecode files according to the Byte Code Engineering Library (BCEL), or parse multiple Java source code files according to the Java Abstract Syntax Tree (AST) parser, wherein the Java information includes metadata of each of the multiple elements included in the multiple Java files and the relationship between each of the multiple elements; further, the processor 100 can store the Java information in a database. The processor 100 can obtain the user's query request, and query the database according to the query request to obtain the query result corresponding to the query request, and finally the processor 100 outputs the query result.

[0051] In this way, the processor 100 parses multiple Java files and stores the Java information obtained by the parsing in the database. In this way, when the developer needs to obtain Java information, the Java information required by the developer can be obtained by directly querying the database 200, so as to meet the developer's query needs, so that the relevant files of the computer software are not circulated to the developer. For example, the important Java source code files and Jar files in the computer software are transparent to the developer, so that the developer can obtain the required Java information without downloading or accessing all the relevant files, effectively reducing the risk of source code leakage, maintaining the security of the computer software, and improving the efficiency of developers in obtaining Java information. In addition, for the Java bytecode files and Java source code files that are commonly present in the Java development environment, the processor 100 can obtain Java information by parsing. Compared with using the development tools in the IDE to parse the relevant code, the problem of incomplete Java information parsing is reduced, and because these Java files match the existing computer software, the timeliness and accuracy of the Java information are effectively guaranteed.

[0052] Understandably, Figure 1 The architecture of the file processing system shown is only an example of an architecture provided by the embodiment of the present application. In other possible file processing systems, more memories, databases, processors, etc. may also be included.

[0053] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, various non-limiting implementation methods in the embodiments of the present application are exemplarily described below in conjunction with the accompanying drawings. Obviously, the described embodiments are 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 ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0054] See also Figure 2 , Figure 2 A schematic diagram of a file processing method in an embodiment of the present application is shown, which can be applied to Figure 1 The file processing system 10 shown in the figure may be applied to other applicable file processing systems. Figure 1 The file processing system 10 shown in FIG. 1 and obtaining Java information from the memory 201 are used as an example for explanation. Figure 2 As shown, the method may specifically include the following steps.

[0055] S201: The processor 100 obtains a plurality of Java files to be processed from the memory 201, where the plurality of Java files include a plurality of Java bytecode files or a plurality of Java source code files.

[0056] A plurality of Java files are stored in the memory 201, and the processor 100 can obtain the Java files to be processed in the memory 201, so as to parse the obtained Java files and obtain Java information. Among them, the Java file can be a Java source code file, which is an original text file written by developers using the Java programming language, containing a number of Java source codes, and having a file extension of ".java". The Java file can also be a Java bytecode file, which is a binary file obtained after the Java source code file is compiled, and having a file extension of ".class". For the above two different Java files, developers can read and understand the Java source code file relatively easily, but it is difficult to read the Java bytecode file directly.

[0057] In a specific implementation, the processor 100 can obtain the Java source file to be processed in the memory 201, and then obtain multiple Java files to be processed by reading the obtained Java source file. Among them, the Java source file can be a Java project file, and the Java project file contains one or more Java source code files. The processor 100 can read the Java project file to obtain the Java source code file. For example, the processor 100 can read all Java source code files under the "src / main" directory in the Java project file. The Java source file can also be a Java Archive (Java Archive, JAR) file, and the JAR file contains one or more Java bytecode files. The processor 100 can read the JAR file to obtain the Java bytecode file. In addition, JAR files can be nested, that is, a JAR file contains other JAR files, and the processor 100 can read other JAR files nested in the JAR file to obtain a Java bytecode file. For example, for the JAR file boot-Jar in the Spring Boot framework, the processor 100 can read all Java bytecode files in the " / BOOT_INF / classes" directory in the boot_jar file, and the processor 100 can also read the Java bytecode files in all dependent library JAR files in the " / BOOT-INF / lib" directory of the boot-jar file.

[0058] It should be noted that the memory 201 may be a local memory directly connected to the processor 100, or a network memory connected to the processor 100 via a network. Java files or Java source files may be stored in a file system in the memory 201. For example, Java files or Java source files may be stored in a disk directory of an operating system in the memory 201, or may be stored in a directory of a network attached storage (NAS) system in the memory 201, or may be stored in a directory of an object storage service (OSS) system in the memory 201. In actual applications, Java files or Java source files may also be stored in other memories or other file systems in the memories, and this is not limited.

[0059] Furthermore, before the processor 100 obtains the Java file to be processed or the Java source file to be processed from the memory 201, the Java file or the Java source file needs to be transferred to the memory 201. There are several implementations of transferring the Java file or the Java source file to the memory 201 as follows.

[0060] In a first implementation, the Java file or Java source file in the memory 201 can be directly transferred by the developer to the memory 201. The Java file or Java source file can be transferred by the developer to the memory 201 through a network connection, or can be transferred by the developer to the memory 201 through a bus connected to the memory 201. For example, the developer can directly transfer the JAR file or Java project file to the memory 201 through the network.

[0061] In a second implementation, the Java file or Java source file in the memory 201 can be downloaded to the memory 201 by the processor 100 according to the address of the file warehouse. The file warehouse can be an image warehouse, wherein the image warehouse can store JAR files and Java bytecode files, for example, it can be a docker warehouse. The file warehouse can also be a code warehouse, wherein the code warehouse can store Java project files and Java source code files, for example, it can be a GitLab warehouse, a GitHub warehouse or an SVN (Subversion) warehouse. Exemplarily, the processor 100 can download the image file in the image warehouse according to the address of the image warehouse, and read and store the JAR file or Java bytecode file in the image file through a shell script. Alternatively, the processor 100 can download and store the Java project file and Java source code file in the code warehouse according to the address of the code warehouse and the shell script, wherein the shell script can indicate the code branch to which the Java project file or Java source code file belongs. Alternatively, the processor 100 can compile the Java project file or Java source code file downloaded from the code warehouse, and store the compiled Java bytecode file. Alternatively, the processor 100 may compile and package the Java project file or Java source code file downloaded from the code repository, and store the packaged JAR file.

[0062] It should be noted that the processor 100 can download all files in the file warehouse to the memory 201, can also download a specified part of the files in the file warehouse to the memory 201, and can also download a part of the updated files in the file warehouse to the memory 201, without limitation. In addition, the shell script mentioned above can be pre-configured in the processor 100. In actual application, Java files or Java source files can also be transmitted to the memory 201 based on other methods, without limitation. For example, for a file processing system 10 that supports the SPI (Service Provider Interface) mechanism, the file processing system 10 can flexibly expand other transmission methods so that Java files or Java source files are transmitted to the memory 201 based on other transmission methods.

[0063] Optionally, different storage rules may exist for storing Java files and Java source files in the memory 201. Exemplarily, Java files and Java source files may be stored in the memory 201 based on a preconfigured storage directory naming rule, for example, the processor 100 may name the files based on a naming rule such as a development timestamp and a name of a service to which they belong. Java files and Java source files may also be stored in the memory 201 based on a preconfigured file storage period, for example, the processor 100 may configure a corresponding file storage period for each Java file and Java source file based on a development timestamp, and files with later timestamps have corresponding file storage periods that are longer, and the processor 100 may automatically delete files in the memory 201 that exceed the file storage period.

[0064] S202: The processor 100 parses the multiple Java files to obtain Java information, where the Java information includes metadata of each of the multiple elements included in the multiple Java files and relationships between the multiple elements.

[0065] The processor 100 can parse the acquired multiple Java files to obtain Java information, so that developers can optimize, reconstruct or develop new functions for computer software based on the Java information. Java information includes metadata of each of the multiple elements included in the multiple Java files and the relationship between the multiple elements, where the elements can be classes, methods, variables, APIs (Application Programming Interfaces) or enumerations, etc., or other elements in a distributed microservice architecture, such as services, boot-Jar, Java files, Java source files, etc.

[0066] Figure 3This is an example of the metadata of each element and the relationship between each element. The rectangular box shows the elements in the Java file, including classes, methods, variables, interfaces, and APIs; the oval box shows the metadata of each element, which can indicate the attribute information of each element; the diamond box shows the relationship between each element.

[0067] For the metadata of each element, specifically, the metadata of a class may include the package name of the class, the name of the class, the annotation of the class, and the access identifier, wherein the access identifier may be public, protected, default, or private. The metadata of a method may include the input parameters of the method, the output parameters of the method, the annotation of the method, the start and end line numbers of the method, and the access identifier, wherein the input parameters of the method may be one or more, and the start and end line numbers of the method are the starting and ending positions of the method in the Java source code file. The metadata of a variable may include the type of the variable, the data type of the variable, the initial value of the variable, and the access identifier, wherein the type of the variable may be a global variable or a local variable, or a class variable or a method variable, and the data type of the variable may be basic data types such as integer, floating point, character, Boolean, or reference data types such as class, interface, array, etc. The metadata of an API includes the name of the microservice corresponding to the API, the API request method, and the API URI (Uniform Resource Identifier), where the API request method can be GET (get), POST (send), PUT (update), DELETE (delete) or PATCH (partial update), and the API URI can be the API's URL (Uniform Resource Locator) and / or URN (Uniform Resource Name).

[0068] As for the relationship between the elements, specifically, there is a containment relationship between classes and variables, and a class can contain one or more variables. There is a containment relationship between classes and methods, and a class can contain one or more methods. There is a containment relationship between methods and variables, and a method can contain one or more variables. There is an implementation relationship between classes and interfaces, and a class can implement one or more interfaces, and an interface can also be implemented by one or more classes. There is a mapping relationship between methods and APIs, and a method can map one or more APIs, and an API can also map one or more methods. There is an inheritance relationship between classes, and a class can be inherited by multiple classes. There is an inheritance relationship between interfaces, and an interface can inherit multiple interfaces, and an interface can also be inherited by multiple interfaces. There is a calling relationship between methods, and a method can call multiple methods, and a method can also be called by multiple interface methods. In addition, there can be other relationships between the elements. For example, there can be a reference relationship between classes and between classes and interfaces, there can be an inclusion relationship between classes and between classes and interfaces, there can be a mapping relationship between the input participating classes of a method, between the input participating interfaces of a method, and between the input participating enumerations of a method, there can also be a mapping relationship between the output participating classes of a method, between the output participating interfaces of a method, and between the output participating enumerations of a method.

[0069] Figure 4 is another example of the relationship between the elements. The rectangular boxes show the elements in the Java file, including services, boot-Jar, JAR files, and bytecode files; the diamond boxes show the relationship between the elements. There is an inclusion relationship between services and boot-Jar, and one service can contain multiple boot-Jars; there is also an inclusion relationship between boot-Jar and JAR files, and one boot-Jar can contain multiple JAR files; there is also an inclusion relationship between JAR files and bytecode files, and one JAR file can contain multiple bytecode files; there is also an inclusion relationship between boot-Jar and bytecode files, and one boot-Jar can contain multiple bytecode files.

[0070] It should be noted that the above-mentioned different elements, metadata of each element and the relationship between each element are only some exemplary explanations. In actual application, the Java information parsed by the processor 100 may also include other elements, more metadata of each element and more relationships between each element, and this is not limited to this.

[0071] In this embodiment, the following implementation examples of the processor 100 parsing a Java file to obtain Java information are provided.

[0072] In the first implementation example, the Java file can be a Java bytecode file, and the processor 100 can parse the Java bytecode file according to BCEL. Specifically, the processor 100 can load the Java bytecode file through BCEL, and parse it through the API provided by BCEL to obtain preliminary Java information. For example, the processor 100 can obtain the JavaClass object corresponding to the Java bytecode file through the ClassParser class provided by BCEL, wherein the JavaClass object contains information such as the class name, interface, parent class, class field, and each method in the class; the processor 100 can also traverse each method in the class through the Field and Method classes provided by BCEL to obtain the name of each method, access identifier and other information; the processor 100 can also obtain the bytecode instruction through the InstructionList class provided by BCEL, and find and identify the invoke series instructions by traversing the bytecode instructions of each method, and obtain the call relationship between methods and other information; the processor 100 can also obtain the annotation information through the AnnotationEntry class provided by BCEL, and obtain the API-related annotations by checking the annotation information of each method, so as to obtain the request method, URI and other information of the API. Furthermore, the processor 100 can organize the preliminary Java information obtained by parsing to obtain Java information such as metadata of each element in the Java bytecode file and the relationship between each element. For example, the processor 100 can obtain the inheritance relationship between classes based on the parent class information contained in the JavaClass object. The processor 100 can also obtain the metadata of variables and the inclusion relationship between classes and variables based on the fields of the class contained in the JavaClass object.

[0073] In the second implementation example, the Java file may be a Java source code file, and the processor 100 may parse the Java source code file according to the AST parser. Specifically, the processor 100 may load and parse the Java source code file through the AST parser to obtain the AST structure corresponding to the Java source code file, wherein the AST structure includes multiple nodes, for example, the node may be a class definition node, a method declaration node, an annotation node, etc. Furthermore, the processor 100 may obtain the initial Java information by parsing and traversing these nodes. For example, the processor 100 may traverse various definition nodes, and parse various definition nodes by parsing the class name method to obtain various class names; the processor 100 may also traverse various method declaration nodes, and obtain the calling relationship between methods by searching the method call expression nodes in each method declaration node; the processor 100 may also traverse various definition nodes, and parse various definition nodes by checking the parent class method to obtain various parent classes. Furthermore, the processor 100 may organize the preliminary Java information obtained by the parsing, and obtain Java information such as the metadata of each element in the Java source code file and the relationship between each element. For example, the processor 100 may obtain the inheritance relationship between classes according to the parent class information.

[0074] It is worth noting that the above implementation methods of parsing Java files and obtaining Java information by different methods are only some exemplary explanations. In actual application, the processor 100 can also parse Java files and obtain Java information based on other methods, which is not limited. In addition, the processor 100 can also refer to similar methods in the above implementation examples to parse and obtain more elements, more metadata for each element, and more relationships between elements.

[0075] In addition, in a distributed microservice architecture, the calling relationship between services may be based on different calling protocols. For example, the calling protocol may be a Web-based service architecture such as REST or Feign, or an RPC (Remote Procedure Call) framework such as Dubbo, gRPC, or Thrift. The processor 100 can parse the Java file based on different calling protocols and obtain Java information. For example, based on the Rest calling protocol, the processor 100 can obtain the calling relationship of the API between services by comparing whether the API-related annotations and URLs are consistent. In addition, the processor 100 can also search for REST-related annotations to obtain the mapping relationship between REST APIs and methods.

[0076] S203 : The processor 100 stores the Java information in the database 200 .

[0077] The processor 100 stores the parsed Java information in the database 200, so that the developer can query the required Java information according to the database 200. Therefore, the processor 100 can quickly respond to the developer's need to obtain Java information based on the query of the database 200, improve the efficiency of the developer in obtaining Java information, and the Java files and Java source files are not circulated to the developers, effectively reducing the risk of leakage of Java files and Java source files, and maintaining the security of computer software.

[0078] It should be noted that the processor 100 can directly store the parsed Java information in the database 200, or update the Java information stored in the database 200 according to the parsed Java information, so that there is no Java information in the database 200 that does not match the existing computer software.

[0079] S204: The processor 100 obtains a query request from a user.

[0080] S205: The processor 100 queries the database 200 according to the query request and obtains a query result corresponding to the query request.

[0081] S206: The processor 100 outputs the query result.

[0082] The processor 100 can obtain the user's query request, and then the processor 100 queries the database 200 according to the query request, and outputs the query result. Generally, the user can be a developer. It can also be other users who need to use the database 200. Based on this, the user cannot directly obtain the IP address, port information, user name and password of the database 200, so that the user cannot directly access and query the database 200, effectively avoiding the risk of the database being modified or attacked. In addition, the user does not need to use the database statement corresponding to the database 200 to send a query request to the database, which improves the efficiency of the user in obtaining Java information, and also avoids the risk of the database 200 being modified due to the user sending an erroneous database statement.

[0083] As an implementation example, a user queries Java information based on a network browser and a network address, where the network address can be an IP address or a domain name address. The user can enter the Java information query interface in the network browser according to the network address, and the processor 100 can obtain the query request input by the user, and query the database 200 according to the query request to obtain the query result corresponding to the query request, and then the processor 100 outputs the query result to the Java information query interface of the user end. Optionally, the user needs to register or log in before entering the Java information processing interface according to the network address, so that the processor 100 does not need to respond to the query request of the user who is not logged in, avoiding the risk of Java information leakage.

[0084] In addition, without directly accessing the database 200, the user can also obtain the query results by inputting database statements in the Java information query interface, or the user can interact with the database 100 in other ways to obtain the query results, which is not limited to this.

[0085] In this embodiment, the processor 100 may adopt the contents described in the above steps S201 to S203 to continuously obtain and parse Java files, and store the parsed Java information in the database 200. In addition, the processor 100 may adopt the contents described in the above steps S204 to S206 to continuously obtain the user's query request, query the database 200 according to the query request, obtain the query result corresponding to the query request, and then output the query result.

[0086] In addition, the present application also provides a file processing software, see Figure 5 , Figure 5 A schematic diagram of the architecture of a file processing software in an embodiment of the present application is shown. Figure 5 The distributed computing software shown includes:

[0087] The Java file processing layer is used to obtain Java files, parse Java files, store Java information in a database, and query Java information based on a web browser. The Java file processing layer includes a JAR file and Java bytecode file download module, a JAR file and Java bytecode file upload module, a compilation and packaging module, a Java project file and Java source code file download module, a Java project file and Java source code file upload module, a JAR file and Java bytecode file storage module, a Java project file and Java source code file storage module, a Java bytecode file acquisition module, a Java source code file acquisition module, a Java bytecode file parsing module, a Java source code file parsing module, a database module, and a browser module.

[0088] The JAR file and Java bytecode file download module is used to download the JAR file and Java bytecode file according to the address of the image repository.

[0089] The JAR file and Java bytecode file upload module is used to directly obtain the JAR files and Java bytecode files uploaded by developers.

[0090] The compilation and packaging module is used to download Java project files and Java source code files according to the address of the code repository, or directly obtain Java project files and Java source code files uploaded by developers, and then the compilation and packaging module compiles the Java source code files into Java bytecode files, or compiles and packages the Java project files into JAR files.

[0091] The Java project file and Java source code file download module is used to download the Java project file and Java source code file according to the address of the code repository.

[0092] The Java project file and Java source code file upload module is used to directly obtain the Java project files and Java source code files uploaded by developers.

[0093] The JAR file and Java bytecode file storage module is used to store the JAR file and Java bytecode file download module, the JAR file and Java bytecode file upload module, and the JAR file and Java bytecode file obtained by the compilation and packaging module.

[0094] The Java project file and Java source code file storage module is used to store the Java project file and Java source code file obtained by the Java project file and Java source code file download module and the Java project file and Java source code file upload module.

[0095] The Java bytecode file acquisition module is used to acquire the Java bytecode file to be processed from the JAR file and the Java bytecode file storage module.

[0096] The Java source code file acquisition module is used to acquire the Java source code file to be processed from the Java project file and the Java source code file storage module.

[0097] The Java bytecode file parsing module is used to parse the Java bytecode file obtained by the Java bytecode file obtaining module to obtain Java information.

[0098] The Java source code file parsing module is used to parse the Java source code file obtained by the Java source code file obtaining module to obtain Java information.

[0099] The database module is used to update the database according to the Java information parsed by the Java bytecode file parsing module and the Java source code file parsing module, wherein the database module stores metadata of each element and the relationship between each element.

[0100] The browser module is used to obtain the query request of the user end in the network browser, and send the query result corresponding to the query request to the user end according to the Java information stored in the database module.

[0101] The application layer is used to respond to the query requests of different applications of users according to the Java file processing layer. Based on different application scenarios, the application layer can provide applications including lineage analysis, impact analysis and other applications, which are not limited. The following is a detailed introduction to the two application scenarios of lineage analysis and impact analysis.

[0102] Lineage analysis is a possible application of the application layer. After adding new functions, modifying existing functions, or fixing vulnerabilities in computer software, developers can perform regression testing on the computer software, that is, re-executing part or all of the content of the computer software to ensure that the computer software still works properly, thereby effectively ensuring the stability and quality of the computer software. Specifically, in order to improve the coverage of regression testing of computer software, developers need to obtain all direct callers and indirect callers of a certain element, that is, obtain the traffic entrance and lineage view of a certain element. Among them, regression testing can be applicable to single services as well as distributed microservice architectures. In this embodiment, the following examples of application modules for lineage analysis are provided.

[0103] In the first application module, the developer's query request can be the search condition of the element, so that the Java file processing layer queries the database module and obtains a list of elements that meet the search condition, such as Figure 6As shown. Among them, the search conditions of the elements may include service name, package name, class name, interface name, method name, method output parameter, method input parameter, request method and URI. In addition, the search conditions of the elements may also include other metadata of the elements, which are not limited. It should be noted that the elements in the obtained element list may meet all the search conditions or only meet some of the search conditions. In addition, the search of the elements may be an exact search or a fuzzy search, that is, the elements in the element list may completely match or not completely match the content of a certain search condition entered by the developer. For example, if the class name entered by the developer is "A", the class name of the element obtained by the exact search can only be "A", and the class name of the element obtained by the fuzzy search can be "AB" or other classes whose class names contain "A". Further, the developer can enter a query request to obtain Table 1, that is, a list of retrieved elements, wherein the table items of Table 1 may include a sequence number, the number of actual calls, service name, package name, method name, Jar package name, method input parameter, request method and URI. In addition, the table items of Table 1 may also include other contents, which are not limited. The number of real calls is the number of times the elements in Table 1 are called by other elements, where the calling method can be direct calling or indirect calling, but cannot be referenced by other elements.

[0104] In the second application module, developers can query the list of APIs actually called in Table 1, such as Figure 6As shown. Generally, in a microservice architecture, developers can reference SDKs (Software Development Kits) of other services to call APIs in other services, where the SDK may include multiple APIs, and developers may call only some of the multiple APIs. Therefore, the column "Number of actual calls" in Table 1 can indicate the number of times the API in Table 1 is called by other methods. When the number of actual calls of a certain API is 0, it means that the API has not been called. Furthermore, developers can obtain a list of all callers of a certain API through Table 2, where the caller can be a direct call or an indirect call. The table items in Table 2 may include serial number, call level, service name, boot-Jar name, Jar package name, package name, class name, method name, method output parameters, method input parameters, method start and end line numbers, and the line number where the calling code is located. In addition, the table items in Table 2 may also include other content, which is not limited to this. For example, the table items in Table 2 may include a link for a method to call an API. For example, for method 1 that calls the first API, the list of actual calls of the first API includes method 1, the calling level of method 1 is the number of layers that method 1 passes through when calling the first API, the calling link of method 1 is the path that method 1 calls to the first API layer by layer, the method start and end line numbers are the start and end line numbers of the first API in the Java file to which it belongs, and the line number of the calling code refers to the row in which method 1 calls the first API in the Java file to which method 1 belongs.

[0105] In the third application module, developers can query the list of traffic entrances of the methods in Table 1, such as Figure 8 As shown, the traffic inlet of a method can be the traffic inlet inside the service to which the method belongs, or it can be the traffic inlet in a distributed microservice architecture. Figure 7 The figure shows an example of mutual calls between services, where service A includes multiple APIs, namely, "control API A", "distributed scheduling API A", "message queue API A" and other APIs. In service A, multiple APIs call "service A method". In the distributed microservice architecture, "service A method" calls "control API C" in service C and "control API E" in service E. Other services can be understood with reference to the above description, which will not be repeated here.

[0106] For the traffic entry inside the service, the traffic entry of the method is the method or API that directly or indirectly calls the method, and these methods or APIs are not called by other methods or APIs inside the service. Take the traffic entry of the "Service F Method" in the query service F as an example. The traffic entry of the "Service F Method" inside service F is "Control API F", "Distributed Scheduling API F" and "Message Queue API F", and "Control API F", "Distributed Scheduling API F" and "Message Queue API F" are not called by other methods or APIs in service F.

[0107] For the traffic entry in the distributed microservice architecture, the traffic entry of a method is a method or API that directly or indirectly calls the method, and these methods or APIs are not called by any method or API of any service. Take the traffic entry of the "Service E Method" in the query service E as an example for explanation. The traffic entry of the "Service E Method" in the distributed microservice architecture is "Control API A", "Distributed Scheduling API A", "Message Queue API A", "Control API B", "Distributed Scheduling APIB", "Message Queue API B", "Distributed Scheduling API E", "Message Queue API E", and the above traffic entry is not called by any method or API in the distributed microservice architecture. It should be noted that "Control API E" is not the traffic entry of "Service E Method" because "Control API E" is called by "Service B Method" in Service B and "Service A Method" in Service A.

[0108] like Figure 8 Table 3 shown is a list of the traffic entrances of the method, that is, the metadata of the traffic entrances of the method, wherein the table items of Table 3 include serial number, service name, boot-Jar name, Jar package name, package name, class name, method name and JDK version. In addition, the table items of Table 3 may also include other contents, which are not limited to this. For example, the table items of Table 3 may include the access identifier of the class, the input parameters of the method and other contents.

[0109] In the fourth application module, developers can query the lineage view of the methods in Table 1, such as Fig. 9 As shown. Among them, Fig. 9The lineage view shown is the lineage view of method 1. The lineage view includes method 1 and multiple methods that directly or indirectly call method 1, namely method 2 to method 9. The methods in the lineage view are connected by directed edges, and the direction of the directed edges points to the called method. For example, method 2 directly calls method 1, and method 3 indirectly calls method 1 by calling method 2. In addition, method 6, method 7, method 8, and method 9 indirectly call method 1, and these methods are not called by other methods or APIs. Therefore, method 6, method 7, method 8, and method 9 are the traffic entrances of method 1. In addition, the lineage view can also represent other relationships between elements in the database. For example, the directed edges in the lineage view can represent call relationships, inheritance relationships, implementation relationships, inclusion relationships, reference relationships, and other relationships. In addition, the directed edges in the lineage view can also represent the specific type of call relationships. For example, the call of method 2 to method 1 is a call based on the call protocol Feign.

[0110] Furthermore, the calling level between the method that calls method 1 in the lineage view is lower than the calling level threshold, or according to further query requests from the developer, more levels of methods are presented in the lineage view. Thus, the lineage view can present a smaller number of methods to improve the efficiency of the Java file processing layer in generating the lineage view. In addition, the lineage view can also include more information such as the metadata of the method, the direct caller of the method, the direct callee of the method, etc., which is not limited.

[0111] It should be noted that the above-mentioned application modules are only some possible application modules of blood relationship analysis. In other application scenarios, blood relationship analysis may also include more application modules, which is not limited to this.

[0112] Impact analysis is another possible application of the application layer. In order to cope with possible business peaks in computer software, developers need to stress test the services in the computer software. When developers stress test a service in a distributed microservice architecture, they need to test other services that will be affected when the service has a business peak to ensure the integrity of the stress test, thereby effectively improving the robustness of the computer software. Specifically, developers need to obtain all elements that are directly or indirectly called by a certain element, that is, to obtain the methods or APIs affected by a certain element. In this embodiment, the following examples of application modules for impact analysis are provided.

[0113] In the first application module, the developer's query request can be the search condition of the element, so that the Java file processing layer queries the database module and obtains a list of elements that meet the search condition, such as Figure 6As shown, please refer to the relevant description of the first application module in the blood relationship analysis application. Among them, the retrieval conditions of the elements may include service name, package name, class name, interface name, method name, method output parameter, method input parameter, request method and URI. In addition, the retrieval conditions of the elements may also include other metadata of the elements, which are not limited. Furthermore, the developer can obtain Table 1, i.e., the list of retrieved elements, by inputting a query request, wherein the table items of Table 1 may include serial number, service name, package name, method name, Jar package name, method input parameter, request method and URI. In addition, the table items of Table 1 may also include other contents, which are not limited.

[0114] In the second application module, developers can query the list of all methods affected by the method in Table 1, or developers can query the list of all APIs affected by the method in Table 1, such as Fig.10 As shown, please refer to the relevant description of the third application module in the blood relationship analysis application for details.

[0115] For all methods affected by a method in query Table 1, the methods affected by a method are the methods directly or indirectly called by the method. Figure 7 As shown, the method affected by "Control API A" in query service A is used as an example for explanation. The methods affected by "Control API A" in the distributed microservice architecture include "Service A Method", "Control API C", "Control API E", "Service C Method", "Service E Method", "Control API F" and "Service F Method". For all APIs affected by the method in query Table 1, the API affected by the method is the API directly or indirectly called by the method. Figure 7 As shown, the APIs affected by "Control API A" in query service A are taken as an example. The APIs affected by "Control API A" in the distributed microservice architecture include "Control API C", "Control API E" and "Control API F".

[0116] like Fig.10 Table 5 shown is a list of methods or APIs affected by the method, that is, metadata of the methods or APIs affected by the method, wherein the items in Table 5 include serial number, number of calls, service name, Jar package name, package name, class name, method name, method input parameters, request method, and URI. In addition, the items in Table 3 may also include other contents, which are not limited to this. For example, the items in Table 3 may include class access identifiers, boot-Jar, and other contents.

[0117] In the third application module, developers can query the method-affecting method or API call chain, such as Fig.10 As shown. Figure 7For example, the "control API A" in service A will affect the method "service F method", where the call link of "control API A" indirectly calling "service C method" includes "control API A", "service A method", "control API C" and "service C method", and this call link is the call link of "control API A" affecting "service C method". Table 6 is a list of call links in which methods affect methods or APIs, where the table items in Table 6 may include serial number, service name, boot-Jar name, Jar package name, package name, class name, class access identifier, method name, method output parameter, method input parameter, method start and end line number and the line number where the calling code is located, request method and URI. In addition, the table items in Table 6 may also include other content, which is not limited. Wherein, each line in Table 6 is a method in the call link, and the order in which the serial number increases from line to line is the order in which the method calls other methods or APIs. For example, the method with sequence number 1 calls the method with sequence number 2 at the position indicated by the “line number where the calling code is located”, wherein the “method start and end line numbers” indicate the start and end positions of the method with sequence number 2 in the corresponding Java file.

[0118] In the fourth application module, developers can query the impact view of the methods in Table 4, such as Fig.11 As shown. Among them, Fig.11 The impact view shown is the impact view of method 1. The impact view includes method 1 and multiple methods directly or indirectly called by method 1, namely method 2 to method 10. The methods in the impact view are connected by directed edges, and the direction of the directed edges points to the called method. For example, method 1 directly calls method 2, and method 1 indirectly calls method 7 by calling method 3. In addition, the impact view can also represent other relationships between elements in the database. For example, the directed edges in the impact view can represent call relationships, inheritance relationships, implementation relationships, inclusion relationships, reference relationships, and other relationships. In addition, the directed edges in the impact view can also represent the specific type of call relationship. For example, the call of method 1 to method 2 is a call based on the call protocol Feign.

[0119] Furthermore, the call level between method 1 and the method called by method 1 in the impact view is lower than the call level threshold, and according to further query requests by developers, more levels of methods can be presented in the impact view. Thus, the impact view can present a smaller number of methods to improve the efficiency of the Java file processing layer in generating the impact view. In addition, the impact view can also include more information such as method metadata, direct callers of methods, direct callees of methods, etc., which are not limited.

[0120] It should be noted that the above application modules are only some possible application modules of impact analysis. In other application scenarios, impact analysis can also include more application modules, which is not limited. In addition, lineage analysis or impact analysis is only a possible application of the application layer. In other application scenarios, the application layer can also include more applications, which is not limited.

[0121] The API interface layer is used for third-party users to execute corresponding applications based on the API provided by the application layer. For example, a third-party user can call the API of the bloodline analysis application to obtain the corresponding Java information, or a third-party user can call the API of the impact analysis application to obtain the corresponding Java information.

[0122] In addition, the present application also provides a file processing device. Fig.12 , Fig.12 A schematic diagram of the structure of a file processing device in an embodiment of the present application is shown. Fig.12 The file processing device 300 shown includes:

[0123] An acquisition module 301 is used to acquire multiple Java files to be processed, wherein the multiple Java files include multiple Java bytecode files or multiple Java source code files; the acquisition module 301 is also used to acquire a user's query request; a parsing module 302 is used to parse the multiple Java files to obtain Java information, wherein the Java information includes metadata of each element in the multiple elements in the multiple Java files and the relationship between each element in the multiple elements; a storage module 303 is used to store the Java information in a database; a query module 304 is used to query the database according to the query request to obtain a query result corresponding to the query request; an output module 305 is used to output the query result.

[0124] In a possible implementation, the multiple Java files are multiple Java bytecode files, and the parsing module 302 is specifically used to parse the multiple Java bytecode files according to the bytecode engineering library BCEL.

[0125] In a possible implementation, the multiple Java files are multiple Java source code files, and the parsing module 302 is specifically used to parse the multiple Java source code files according to a Java abstract syntax tree AST parser.

[0126] In a possible implementation, the acquisition module 301 is specifically used to: acquire at least one Java source file to be processed, each Java source file in the at least one Java source file is a Java project file or a Java archive JAR file; and read the multiple Java files from the at least one Java source file.

[0127] In a possible implementation, the query request is a traffic entry of a first method, the first method is an element in the database, and the query module 304 is specifically used to: query multiple methods in the database that call the first method according to the query request, and the multiple methods are not called by any method in the database, and obtain metadata of the multiple methods.

[0128] In a possible implementation, the query request is an influencing method of a second method, the second method is an element in the database, and the query module 304 is specifically used to: query multiple methods called by the second method in the database according to the query request, and obtain metadata of the multiple methods.

[0129] In one possible implementation, the query request is a lineage view of a third method, and the third method is an element in the database. The query module 304 is specifically used to: query multiple methods in the database that call the third method according to the query request to obtain the lineage view, wherein the lineage view includes the third method and the multiple methods, and the third method and each method in the multiple methods are connected by directed edges, and the direction of the directed edges points to the called method.

[0130] In a possible implementation, the query request is an impact view of a fourth method, and the fourth method is an element in the database. The query module 304 is specifically used to: query multiple methods called by the fourth method in the database according to the query request to obtain the impact view, and the impact view includes the fourth method and the multiple methods. The fourth method and each method in the multiple methods are connected by directed edges, and the direction of the directed edges points to the called method. The query result is the impact view.

[0131] It should be noted that the information interaction, execution process, etc. between the modules and units of the above-mentioned device are based on the same concept as the method embodiment in the embodiments of the present application, and the technical effects they bring are the same as those of the method embodiment in the embodiments of the present application. For specific contents, please refer to the description in the method embodiment shown in the aforementioned embodiments of the present application, and will not be repeated here.

[0132] In addition, the present application embodiment also provides a computing device. Fig.13 , Fig.13 FIG. 1 is a schematic diagram showing the hardware structure of a computing device in an embodiment of the present application. Fig.13 As shown, computing device 400 may include a processor 401 and a memory 402 .

[0133] Wherein, the memory 402 is used to store computer programs;

[0134] The processor 401 is used to execute the distributed computing method described in the above method embodiment according to the computer program.

[0135] In addition, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the file processing method described in the above method embodiment.

[0136] In addition, an embodiment of the present application also provides a computer program product containing instructions, which, when executed on a computing device, enables the computing device to execute the file processing method described in the above method embodiment.

[0137] The "first" in the names of "first API", "first method", etc. mentioned in the embodiments of the present application is only used as a name identifier and does not mean the first in order. The same rule applies to "second", "third", etc.

[0138] Through the description of the above implementation methods, it can be known that those skilled in the art can clearly understand that all or part of the steps in the above-mentioned embodiment method can be implemented by means of software plus a general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a read-only memory (ROM) / RAM, a magnetic disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network communication device such as a router) to execute the methods described in each embodiment of the present application or some parts of the embodiments.

[0139] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, in which the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0140] The above description is merely an exemplary embodiment of the present application and is not intended to limit the protection scope of the present application.

Claims

1. A file processing method, characterized in that: The method comprises: Acquire a plurality of Java files to be processed, wherein the plurality of Java files include a plurality of Java bytecode files or a plurality of Java source code files; Parsing the multiple Java files to obtain Java information, the Java information including metadata of each of the multiple elements included in the multiple Java files and relationships between the multiple elements; Storing the Java information in a database; Get the user's query request; According to the query request, query the database to obtain a query result corresponding to the query request; The query result is output.

2. The method according to claim 1, characterized in that The multiple Java files are multiple Java bytecode files, and the parsing of the multiple Java files includes: The multiple Java bytecode files are parsed according to the bytecode engineering library BCEL.

3. The method according to claim 1, characterized in that The multiple Java files are multiple Java source code files, and the parsing of the multiple Java files includes: The multiple Java source code files are parsed according to a Java Abstract Syntax Tree (AST) parser.

4. The method according to claim 1, characterized in that: The obtaining of multiple Java files to be processed includes: Obtain at least one Java source file to be processed, each Java source file in the at least one Java source file being a Java project file or a Java archive JAR file; The multiple Java files are obtained by reading from the at least one Java source file.

5. The method according to any one of claims 1 to 4, characterized in that: The query request is a traffic entry of the first method, the first method is an element in the database, and querying the database according to the query request to obtain a query result corresponding to the query request includes: According to the query request, multiple methods in the database that call the first method are queried, and the multiple methods are not called by any method in the database, and metadata of the multiple methods are obtained.

6. The method according to any one of claims 1 to 4, characterized in that: The query request is an influencing method of the second method, the second method is an element in the database, and querying the database according to the query request to obtain a query result corresponding to the query request includes: According to the query request, multiple methods called by the second method in the database are queried to obtain metadata of the multiple methods.

7. The method according to any one of claims 1 to 4, characterized in that: The query request is a lineage view of the third method, the third method is an element in the database, and querying the database according to the query request to obtain a query result corresponding to the query request includes: According to the query request, multiple methods that call the third method are queried in the database to obtain the lineage view, which includes the third method and the multiple methods. The third method and each method in the multiple methods are connected by directed edges, and the direction of the directed edges points to the called method.

8. The method according to any one of claims 1 to 4, characterized in that: The query request is the impact view of the fourth method, the fourth method is an element in the database, and querying the database according to the query request to obtain a query result corresponding to the query request includes: According to the query request, multiple methods called by the fourth method in the database are queried to obtain the impact view, wherein the impact view includes the fourth method and the multiple methods, the fourth method and each method in the multiple methods are connected by directed edges, and the direction of the directed edge points to the called method, and the query result is the impact view.

9. A file processing device, characterized in that: The device comprises: An acquisition module, the acquisition module is used to acquire multiple Java files to be processed, the multiple Java files include multiple Java bytecode files or multiple Java source code files; the acquisition module is also used to acquire a user's query request; A parsing module, the parsing module is used to parse the multiple Java files to obtain Java information, the Java information including metadata of each of the multiple elements in the multiple Java files and the relationship between the multiple elements in the multiple elements; A storage module, wherein the storage module is used to store the Java information in a database; A query module, the query module is used to query the database according to the query request to obtain a query result corresponding to the query request; An output module, wherein the output module is used to output the query result.

10. A computing device, characterized in that: The computing device comprises a processor and a memory: The memory is used to store computer programs; The processor is configured to execute the method of any one of claims 1 to 8 according to the computer program.