CN113157258A - Information processing method, information processing apparatus, storage medium, and electronic device - Google Patents

Information processing method, information processing apparatus, storage medium, and electronic device Download PDF

Info

Publication number
CN113157258A
CN113157258A CN202110431005.XA CN202110431005A CN113157258A CN 113157258 A CN113157258 A CN 113157258A CN 202110431005 A CN202110431005 A CN 202110431005A CN 113157258 A CN113157258 A CN 113157258A
Authority
CN
China
Prior art keywords
target
bridging
information
class
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110431005.XA
Other languages
Chinese (zh)
Inventor
蒲彩琳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dingshixing Education Consulting Co ltd
Original Assignee
Beijing Dingshixing Education Consulting Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dingshixing Education Consulting Co ltd filed Critical Beijing Dingshixing Education Consulting Co ltd
Priority to CN202110431005.XA priority Critical patent/CN113157258A/en
Publication of CN113157258A publication Critical patent/CN113157258A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The disclosure relates to an information processing method, an information processing apparatus, a storage medium, and an electronic device. The information processing method comprises the following steps: in the running process of a target program, responding to the acquisition of a target bridging method meeting a preset condition, and determining method information included in a first byte code file according to the first byte code file of the class where the target bridging method is located; traversing the method information included in the first byte code file to obtain the related information of the target bridging method, and determining an attribute table of the target bridging method according to the related information of the target bridging method; and acquiring relevant information of a target actual method corresponding to the target bridging method according to a target instruction included in the attribute table, wherein the target instruction is an instruction for indicating and storing the relevant information of the target actual method. According to the method and the device, when the actual method of the bridging method is searched, the time consumption is short, and the searching efficiency is high.

Description

Information processing method, information processing apparatus, storage medium, and electronic device
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an information processing method and apparatus, a storage medium, and an electronic device.
Background
The bridging method is a method automatically generated by a compiler in order to make the bytecode generated by the Java generic method compatible with the bytecode before the Java1.5 version. For example, when a child class overwrites a method with a generic type in a parent class, or when the child class method and parent class method return values do not match, the Java compiler will automatically generate a bridging method.
However, for some scenarios during program running, the actual method of finding the bridge method by the bridge method is needed to perform the subsequent operations. For example, during the program running process, when annotations (e.g.: @ Cacheable, @ WebServiceRef) of an actual method are used and analyzed, a bridge method which may be the actual method is acquired through a reflection mechanism of Java, and because relevant attributes (e.g.: parameter type, return type) of the bridge method are inaccurate, the relevant attributes of the actual method must be used for subsequent operations.
Furthermore, finding a practical approach by the bridging method is a problem that must be solved.
Disclosure of Invention
To overcome the problems in the related art, the present disclosure provides an information processing method, an information processing apparatus, a storage medium, and an electronic device.
According to a first aspect of embodiments of the present disclosure, there is provided an information processing method, the method including:
in the running process of a target program, in response to the acquisition of a target bridging method meeting a preset condition, determining method information included in a first bytecode file according to the first bytecode file of the class where the target bridging method is located, wherein the preset condition represents that a target actual method corresponding to the target bridging method needs to be acquired according to the target bridging method;
traversing the method information included in the first byte code file to obtain the relevant information of the target bridging method, and determining an attribute table of the target bridging method according to the relevant information of the target bridging method;
and acquiring relevant information of a target actual method corresponding to the target bridging method according to a target instruction included in the attribute table, wherein the target instruction is an instruction for indicating to store the relevant information of the target actual method.
Optionally, the determining, according to the first bytecode file of the class in which the target bridging method is located, method information included in the first bytecode file includes:
loading a first byte code file of a class where the target bridging method is located;
and analyzing the method included by the first byte code file to obtain the method information included by the first byte code file.
Optionally, the obtaining, according to a target instruction included in the attribute table, information related to a target actual method corresponding to the target bridging method includes:
acquiring an index value pointing to relevant information for storing the target actual method by the target instruction;
determining a fully qualified name of the target actual method according to the index value;
and determining the related information of the target actual method according to the completely qualified name.
Optionally, the determining the relevant information of the target actual method according to the fully qualified name includes:
determining the class of the target actual method according to the completely qualified name;
and if the class of the target actual method and the class of the target bridging method are the same, inquiring and obtaining the relevant information of the target actual method from the method information included in the first byte code file.
Optionally, the determining, according to the fully qualified name, related information of the target actual method further includes:
if the class of the target actual method is a parent class of the target bridging method, determining method information included in a second byte code file according to the second byte code file of the class of the target actual method;
and traversing the method information included in the second byte code file to obtain the related information of the target actual method.
Optionally, the determining, according to the second bytecode file of the class in which the target actual method is located, method information included in the second bytecode file includes:
loading a second byte code file of the class where the target actual method is located;
and analyzing the method included by the second byte code file to obtain the method information included by the second byte code file.
Optionally, after the obtaining of the information related to the target actual method corresponding to the target bridging method, the method further includes:
and correspondingly caching the relevant information of the target bridging method and the relevant information of the target actual method.
Optionally, the method further comprises:
scanning a method carrying annotation information in the running process of the target program;
when the scanned method carrying annotation information is a bridging method, determining to acquire a target bridging method meeting preset conditions.
Optionally, the target program is a Java program;
the attribute table of the target bridging method is a code attribute table of the target bridging method; and
the target instruction is an invokevirtual instruction.
According to a second aspect of the embodiments of the present disclosure, there is provided an information processing apparatus, the apparatus including:
the device comprises a first determining module, a second determining module and a third determining module, wherein the first determining module is used for responding to the acquisition of a target bridging method meeting a preset condition in the running process of a target program, and determining method information included in a first byte code file according to the first byte code file of the class where the target bridging method is located, wherein the preset condition represents that a target actual method corresponding to the target bridging method needs to be acquired according to the target bridging method;
the second determining module is used for traversing the method information included in the first bytecode file to obtain the relevant information of the target bridging method, and determining the attribute table of the target bridging method according to the relevant information of the target bridging method;
and the acquisition module is used for acquiring relevant information of a target actual method corresponding to the target bridging method according to a target instruction included in the attribute table, wherein the target instruction is an instruction for indicating to store the relevant information of the target actual method.
Optionally, the first determining module determines the method information included in the first bytecode file by:
loading the first byte code file of the class of the target bridging method according to the first byte code file of the class of the target bridging method;
and analyzing the method included by the first byte code file to obtain the method information included by the first byte code file.
Optionally, the obtaining module obtains, according to a target instruction included in the attribute table, information related to a target actual method corresponding to the target bridging method, in the following manner:
acquiring an index value pointing to relevant information for storing the target actual method by the target instruction;
determining a fully qualified name of the target actual method according to the index value;
and determining the related information of the target actual method according to the completely qualified name.
Optionally, the obtaining module determines the relevant information of the target actual method according to the fully qualified name by:
determining the class of the target actual method according to the completely qualified name;
and if the class of the target actual method and the class of the target bridging method are the same, inquiring and obtaining the relevant information of the target actual method from the method information included in the first byte code file.
Optionally, the obtaining module is further configured to:
if the class of the target actual method is a parent class of the target bridging method, determining method information included in a second byte code file according to the second byte code file of the class of the target actual method;
and traversing the method information included in the second byte code file to obtain the related information of the target actual method.
Optionally, the obtaining module determines, according to the second bytecode file of the class in which the target actual method is located, method information included in the second bytecode file by using the following method:
loading a second byte code file of the class where the target actual method is located;
and analyzing the method included by the second byte code file to obtain the method information included by the second byte code file.
Optionally, after the obtaining of the information related to the target actual method corresponding to the target bridging method, the apparatus further includes a storage module;
the storage module is used for correspondingly caching the relevant information of the target bridging method and the relevant information of the target actual method.
Optionally, the obtaining module is further configured to:
scanning a method carrying annotation information in the running process of the target program;
when the scanned method carrying annotation information is a bridging method, determining to acquire a target bridging method meeting preset conditions.
Optionally, the target program is a Java program;
the attribute table of the target bridging method is a code attribute table of the target bridging method; and
the target instruction is an invokevirtual instruction.
By the technical scheme, in the running process of the target program, when the target bridging method is obtained in response to the fact that the target bridging method meets the requirement of the target actual method according to the target bridging method, the attribute table of the target bridging method can be obtained through query according to the first byte code file of the class where the target bridging method is located, the related information of the target actual method corresponding to the target bridging method can be directly obtained according to the target instruction in the attribute table of the target bridging method, the time consumption for searching the target actual method is short, no matter how complex the inheritance relationship between the target bridging method and the target actual method is, the number of methods in the class including the target actual method is large, the time consumption for searching the target actual method cannot be increased, and the searching efficiency is high.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure without limiting the disclosure. In the drawings:
fig. 1 is a flow chart illustrating an information processing method according to an example embodiment.
Fig. 2 is a flow chart illustrating an information processing method according to an example embodiment.
Fig. 3 is a block diagram illustrating an information processing apparatus according to an example embodiment.
FIG. 4 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
The following detailed description of specific embodiments of the present disclosure is provided in connection with the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present disclosure, are given by way of illustration and explanation only, not limitation.
At present, during program operation, when searching for an actual method of a bridging method, all methods are traversed, a method of all parents of a class where the bridging method is located is found first, and then the actual method of the bridging method is determined by matching the methods with the bridging method one by one according to the method names, the parameter numbers, the general type parameters and the like of all the parents.
In the method, when the inheritance relationship between the bridging method and the actual method is more and more complex and the number of the methods to be searched is more and more, the time consumption of the actual method for searching the bridging method by using the traversal mode is longer and longer.
In view of this, the present disclosure provides an information processing method to improve the efficiency of the actual method for searching the bridge method.
Fig. 1 is a flowchart illustrating an information processing method according to an exemplary embodiment, and as shown in fig. 1, the information processing method includes the following steps.
In step S11, in the running process of the target program, in response to acquiring the target bridging method that meets the preset condition, the method information included in the first bytecode file is determined according to the first bytecode file of the class in which the target bridging method is located.
The preset condition representation needs to obtain a target actual method corresponding to the target bridging method according to the target bridging method. The target bridging method for acquiring the target meeting the preset condition may be the target bridging method for acquiring the target with the bridging method identifier.
Furthermore, according to the bytecode file of the class where the target bridging method is located, method information included in the bytecode file can be determined, and information related to the bridging method included in the bytecode file can also be determined and obtained.
For convenience of description, the bytecode file of the class in which the target bridging method is located is referred to as a first bytecode file.
In one embodiment, the method information included in the first bytecode file may be determined, for example, by:
and loading the first bytecode file of the class of the target bridging method according to the first bytecode file of the class of the target bridging method, and then analyzing all methods included in the first bytecode file to obtain method information of all methods included in the first bytecode file.
In step S12, the method information included in the first bytecode file is traversed to obtain the relevant information of the target bridging method, and the attribute table of the target bridging method is determined according to the relevant information of the target bridging method.
In one embodiment, after obtaining the method information of all methods included in the first bytecode file, the related information of the target bridging method can be obtained by traversing from the method information of all methods included in the first bytecode file, and the attribute table of the target bridging method can be determined and obtained according to the related information of the target bridging method.
The attribute table of the target bridging method stores information such as how to run the target bridging method and instructions for running the target bridging method.
In step S13, the relevant information of the target actual method corresponding to the target bridging method is acquired according to the target instruction included in the attribute table, where the target instruction is an instruction indicating to store the relevant information of the target actual method.
In one embodiment, the information about the target actual method corresponding to the target bridging method may be obtained, for example, as follows:
according to the target instruction included in the attribute table, acquiring an index value of the relevant information of the target actual method pointed by the target instruction, determining a completely limited name of the target actual method according to the index value of the relevant information of the target actual method, and determining the relevant information of the target actual method according to the completely limited name of the target actual method.
Wherein, for example, the relevant information of the target actual method can be determined according to the completely defined name in the following way:
since the completely qualified names include package names, class names, method names, parameter lists and the like of corresponding methods, the present disclosure can determine the class of the target actual method according to the completely qualified name of the target actual method.
In one embodiment, if the class of the target actual method and the class of the target bridging method are the same, the related information of the target actual method is obtained by querying from the method information included in the first bytecode file.
In another embodiment, if the class of the target actual method is a parent class of the target bridging method, determining method information included in a second bytecode file according to the second bytecode file of the class of the target actual method, and traversing the method information included in the second bytecode file to obtain related information of the target actual method. When the method information included in the second bytecode file is determined according to the second bytecode file of the class where the target actual method is located, for example, the method information included in the second bytecode file can be obtained by loading the second bytecode file of the class where the target actual method is located, analyzing the method included in the second bytecode file, and obtaining the method information included in the second bytecode file.
In addition, after the target actual method is found by the target bridging method, when the program runs and the target actual method is found again according to the target bridging method conveniently and quickly, the related information of the target bridging method and the related information of the target actual method can be cached correspondingly without re-executing the step of finding the target actual method by the target bridging method, and the efficiency of finding the target actual method is further improved.
In the exemplary embodiment of the disclosure, in the running process of the target program, when the target bridging method is obtained in response to the acquisition of the target bridging method and the target bridging method meets the requirement of finding the target actual method according to the target bridging method, the attribute table of the target bridging method can be obtained by querying according to the first bytecode file of the class where the target bridging method is located, the related information of the target actual method corresponding to the target bridging method can be directly obtained according to the target instruction included in the attribute table of the target bridging method, the time consumption for finding the target actual method is short, and the time consumption for finding the target actual method cannot be increased no matter how many inheritance relationships are between the target bridging method and the target actual method, the number of methods in the class including the target actual method is large, and the finding efficiency is high.
The present disclosure describes the information processing method in detail below in conjunction with a bridging method to find an application scenario of an actual method.
Fig. 2 is a flow chart illustrating an information processing method according to an exemplary embodiment, as shown in fig. 2, the information processing method including the following steps.
In step S21, in the running process of the target program, a method for scanning the annotation-carrying information is scanned, and when the scanned annotation-carrying information is a bridging method, it is determined that a target bridging method meeting a preset condition is acquired.
In the present disclosure, the target program may be a Java program, and the annotation information may be, for example, a parameter name including a parameter that needs to be cached. In the running process of the target program, the method with the annotation information means that the parameter matched with the annotation information in the method needs to be cached, and in the running process of the target program, when the scanned method is the bridging method, an actual method of the bridging method needs to be found according to the bridging method, and then the caching operation of the parameter matched with the annotation information is executed according to the found relevant attribute of the actual method.
Furthermore, in the running process of the target program, when the target bridging method meeting the preset condition is acquired, the method information included in the first bytecode file and the target bridging method information can be determined according to the first bytecode file of the class where the target bridging method is located, a target instruction which is included in the attribute table and can acquire the relevant information of the target actual method corresponding to the target bridging method can be found according to the attribute table of the target bridging method in the target bridging method information, and the relevant information of the target actual method corresponding to the target bridging method can be acquired according to the target instruction.
In step S22, in the running process of the target program, in response to acquiring the target bridging method that meets the preset condition, the method information included in the first bytecode file is determined according to the first bytecode file of the class in which the target bridging method is located.
The first bytecode file may be a file generated after the Java source code is compiled, and may be, for example, a class file.
In step S23, the method information included in the first bytecode file is traversed to obtain the relevant information of the target bridging method, and the attribute table of the target bridging method is determined according to the relevant information of the target bridging method.
The attribute table of the target bridging method may be, for example, a code attribute table of the target bridging method.
In step S24, the relevant information of the target actual method corresponding to the target bridging method is acquired according to the target instruction included in the attribute table, where the target instruction is an instruction indicating to store the relevant information of the target actual method.
Wherein, the target instruction is an invokevirtual instruction. And according to the index value of the related information of the target actual method pointed by the invokevirtual instruction in the code attribute table of the target bridging method, namely the index value of the related information of the target actual method stored in the constant pool, determining the completely limited name of the target actual method according to the index value, and determining the related information of the target actual method according to the completely limited name.
Furthermore, in the application scenario, the parameter name matching the annotation information in the target actual method can be found according to the relevant information of the target actual method, and the parameter called each time is obtained as the key word of the cache for caching according to the parameter name matching the annotation information in the target actual method.
In the exemplary embodiment of the disclosure, in the running process of a target program, a method for scanning the carried annotation information is scanned, and when the scanned method for carrying annotation information is a bridging method, it is determined that a target bridging method meeting a preset condition is acquired. And then according to the first byte code file of the class where the target bridging method is located, a property table of the target bridging method can be obtained through inquiry, according to a target instruction included in the property table of the target bridging method, the related information of the target actual method corresponding to the target bridging method can be directly obtained, the time consumption for searching the target actual method is short, no matter how complex the inheritance relationship between the target bridging method and the target actual method is, the number of methods in the class including the target actual method is, the time consumption for searching the target actual method cannot be increased, and the searching efficiency is high.
FIG. 3 is a block diagram 300 illustrating an information processing apparatus according to an example embodiment. Referring to fig. 3, the apparatus includes a first determining module 301, a second determining module 302, and an obtaining module 303.
The first determining module 301 is configured to, in a running process of a target program, determine, in response to obtaining a target bridging method meeting a preset condition, method information included in a first bytecode file according to the first bytecode file of a class in which the target bridging method is located, where the preset condition represents that a target actual method corresponding to the target bridging method needs to be obtained according to the target bridging method;
a second determining module 302, configured to traverse the method information included in the first bytecode file, to obtain relevant information of the target bridging method, and determine an attribute table of the target bridging method according to the relevant information of the target bridging method;
an obtaining module 303, configured to obtain, according to a target instruction included in the attribute table, relevant information of a target actual method corresponding to the target bridging method, where the target instruction is an instruction indicating to store the relevant information of the target actual method.
Optionally, the first determining module 301 determines the method information included in the first bytecode file by:
loading the first byte code file of the class of the target bridging method according to the first byte code file of the class of the target bridging method;
and analyzing the method included by the first byte code file to obtain the method information included by the first byte code file.
Optionally, the obtaining module 303 obtains the relevant information of the target actual method corresponding to the target bridging method according to the target instruction included in the attribute table in the following manner:
acquiring an index value of related information of a target instruction pointing to a storage target actual method;
determining a completely qualified name of the target actual method according to the index value;
and determining related information of the target actual method according to the completely defined name.
Optionally, the obtaining module 303 determines the relevant information of the target actual method according to the fully qualified name by:
determining the class of the target actual method according to the completely limited name;
if the class of the target actual method and the class of the target bridging method are the same, inquiring the method information included in the first byte code file to obtain the relevant information of the target actual method.
Optionally, the obtaining module 303 is further configured to:
if the class of the target actual method is a parent class of the target bridging method, determining method information included in a second byte code file according to the second byte code file of the class of the target actual method;
and traversing the method information included in the second byte code file to obtain the related information of the target actual method.
Optionally, the obtaining module 303 determines, according to the second bytecode file of the class where the target actual method is located, method information included in the second bytecode file by using the following method:
loading a second byte code file of the class where the target actual method is located;
and analyzing the method included by the second byte code file to obtain the method information included by the second byte code file.
Optionally, after the obtaining module 303 obtains the relevant information of the target actual method corresponding to the target bridging method, the apparatus further includes a storage module 304;
the storage module 304 is configured to correspondingly cache the relevant information of the target bridging method and the relevant information of the target actual method.
Optionally, the obtaining module 303 is further configured to:
scanning a method carrying annotation information in the running process of a target program;
when the scanned method carrying annotation information is a bridging method, determining to acquire a target bridging method meeting preset conditions.
Optionally, the target program is a Java program;
the attribute table of the target bridging method is a code attribute table of the target bridging method; and
the target instruction is an invokevirtual instruction.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 4 is a block diagram illustrating an electronic device 700 according to an example embodiment. As shown in fig. 4, the electronic device 700 may include: a processor 701 and a memory 702. The electronic device 700 may also include one or more of a multimedia component 703, an input/output (I/O) interface 704, and a communication component 705.
The processor 701 is configured to control the overall operation of the electronic device 700, so as to complete all or part of the steps in the information processing method. The memory 702 is used to store various types of data to support operation at the electronic device 700, such as instructions for any application or method operating on the electronic device 700 and application-related data, such as contact data, transmitted and received messages, pictures, audio, video, and the like. The Memory 702 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk. The multimedia components 703 may include screen and audio components. Wherein the screen may be, for example, a touch screen and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may further be stored in the memory 702 or transmitted through the communication component 705. The audio assembly also includes at least one speaker for outputting audio signals. The I/O interface 704 provides an interface between the processor 701 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 705 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless Communication, such as Wi-Fi, bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, which is not limited herein. The corresponding communication component 705 may thus include: Wi-Fi module, Bluetooth module, NFC module, etc.
In an exemplary embodiment, the electronic Device 700 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the information Processing method described above.
In another exemplary embodiment, there is also provided a computer-readable storage medium including program instructions which, when executed by a processor, implement the steps of the information processing method described above. For example, the computer readable storage medium may be the memory 702 including the program instructions that are executable by the processor 701 of the electronic device 700 to perform the information processing method described above.
In another exemplary embodiment, there is also provided a computer-readable storage medium including program instructions which, when executed by a processor, implement the steps of the information processing method described above. For example, the computer readable storage medium may be the memory 1932 that includes program instructions executable by the processor 1922 of the electronic device 1900 to perform the information processing method described above.
In another exemplary embodiment, a computer program product is also provided, which contains a computer program executable by a programmable apparatus, the computer program having code portions for performing the above-mentioned information processing method when executed by the programmable apparatus.
The preferred embodiments of the present disclosure are described in detail with reference to the accompanying drawings, however, the present disclosure is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solution of the present disclosure within the technical idea of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.
It should be noted that, in the foregoing embodiments, various features described in the above embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, various combinations that are possible in the present disclosure are not described again.
In addition, any combination of various embodiments of the present disclosure may be made, and the same should be considered as the disclosure of the present disclosure, as long as it does not depart from the spirit of the present disclosure.

Claims (12)

1. An information processing method, characterized in that the method comprises:
in the running process of a target program, in response to the acquisition of a target bridging method meeting a preset condition, determining method information included in a first bytecode file according to the first bytecode file of the class where the target bridging method is located, wherein the preset condition represents that a target actual method corresponding to the target bridging method needs to be acquired according to the target bridging method;
traversing the method information included in the first byte code file to obtain the relevant information of the target bridging method, and determining an attribute table of the target bridging method according to the relevant information of the target bridging method;
and acquiring relevant information of a target actual method corresponding to the target bridging method according to a target instruction included in the attribute table, wherein the target instruction is an instruction for indicating to store the relevant information of the target actual method.
2. The method according to claim 1, wherein the determining, according to the first bytecode file of the class in which the target bridging method is located, the method information included in the first bytecode file includes:
loading a first byte code file of a class where the target bridging method is located;
and analyzing the method included by the first byte code file to obtain the method information included by the first byte code file.
3. The method according to claim 1, wherein the obtaining, according to a target instruction included in the attribute table, information related to a target actual method corresponding to the target bridging method includes:
acquiring an index value pointing to relevant information for storing the target actual method by the target instruction;
determining a fully qualified name of the target actual method according to the index value;
and determining the related information of the target actual method according to the completely qualified name.
4. The method according to claim 3, wherein the determining the relevant information of the target actual method according to the fully qualified name comprises:
determining the class of the target actual method according to the completely qualified name;
and if the class of the target actual method and the class of the target bridging method are the same, inquiring and obtaining the relevant information of the target actual method from the method information included in the first byte code file.
5. The method of claim 4, wherein said determining information about said target actual method based on said fully qualified name further comprises:
if the class of the target actual method is a parent class of the target bridging method, determining method information included in a second byte code file according to the second byte code file of the class of the target actual method;
and traversing the method information included in the second byte code file to obtain the related information of the target actual method.
6. The method according to claim 5, wherein the determining, according to the second bytecode file of the class in which the target actual method is located, the method information included in the second bytecode file includes:
loading a second byte code file of the class where the target actual method is located;
and analyzing the method included by the second byte code file to obtain the method information included by the second byte code file.
7. The method according to claim 1, wherein after the obtaining of the information about the target actual method corresponding to the target bridging method, the method further comprises:
and correspondingly caching the relevant information of the target bridging method and the relevant information of the target actual method.
8. The method of claim 1, further comprising:
scanning a method carrying annotation information in the running process of the target program;
when the scanned method carrying annotation information is a bridging method, determining to acquire a target bridging method meeting preset conditions.
9. The method according to any one of claims 1-8, wherein the object program is a Java program;
the attribute table of the target bridging method is a code attribute table of the target bridging method; and
the target instruction is an invokevirtual instruction.
10. An information processing apparatus characterized in that the apparatus comprises:
the device comprises a first determining module, a second determining module and a third determining module, wherein the first determining module is used for responding to the acquisition of a target bridging method meeting a preset condition in the running process of a target program, and determining method information included in a first byte code file according to the first byte code file of the class where the target bridging method is located, wherein the preset condition represents that a target actual method corresponding to the target bridging method needs to be acquired according to the target bridging method;
the second determining module is used for traversing the method information included in the first bytecode file to obtain the relevant information of the target bridging method, and determining the attribute table of the target bridging method according to the relevant information of the target bridging method;
and the acquisition module is used for acquiring relevant information of a target actual method corresponding to the target bridging method according to a target instruction included in the attribute table, wherein the target instruction is an instruction for indicating to store the relevant information of the target actual method.
11. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 9.
12. An electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to carry out the steps of the method of any one of claims 1 to 9.
CN202110431005.XA 2021-04-21 2021-04-21 Information processing method, information processing apparatus, storage medium, and electronic device Pending CN113157258A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110431005.XA CN113157258A (en) 2021-04-21 2021-04-21 Information processing method, information processing apparatus, storage medium, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110431005.XA CN113157258A (en) 2021-04-21 2021-04-21 Information processing method, information processing apparatus, storage medium, and electronic device

Publications (1)

Publication Number Publication Date
CN113157258A true CN113157258A (en) 2021-07-23

Family

ID=76867638

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110431005.XA Pending CN113157258A (en) 2021-04-21 2021-04-21 Information processing method, information processing apparatus, storage medium, and electronic device

Country Status (1)

Country Link
CN (1) CN113157258A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030182457A1 (en) * 2002-03-21 2003-09-25 Brewin Robert F. Method and apparatus for generating a code bridge
CN107402896A (en) * 2016-05-20 2017-11-28 阿里巴巴集团控股有限公司 The method, apparatus and system bridged between computing device
CN108614702A (en) * 2016-12-28 2018-10-02 阿里巴巴集团控股有限公司 Bytecode-optimized method and device
CN111078279A (en) * 2019-12-20 2020-04-28 北京字节跳动网络技术有限公司 Processing method, device and equipment of byte code file and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030182457A1 (en) * 2002-03-21 2003-09-25 Brewin Robert F. Method and apparatus for generating a code bridge
CN107402896A (en) * 2016-05-20 2017-11-28 阿里巴巴集团控股有限公司 The method, apparatus and system bridged between computing device
CN108614702A (en) * 2016-12-28 2018-10-02 阿里巴巴集团控股有限公司 Bytecode-optimized method and device
CN111078279A (en) * 2019-12-20 2020-04-28 北京字节跳动网络技术有限公司 Processing method, device and equipment of byte code file and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
WEIXIN_39548438: "java 桥接_3分钟快速搞懂Java的桥接方法示例", pages 1 - 8, Retrieved from the Internet <URL:https://blog.csdn.net/weixin_39548438/article/details/114598850> *
应天堂: "java反射中的桥接方法", pages 1 - 6, Retrieved from the Internet <URL:https://blog.csdn.net/awei1024/article/details/80247538> *
拿走不谢: "Java系列:关于Java中的桥接方法", pages 1 - 5, Retrieved from the Internet <URL:https://www.cnblogs.com/strinkbug/p/5019453.html> *

Similar Documents

Publication Publication Date Title
CN106951228B (en) Method and device for processing differences in version iteration
CN110955416A (en) Interface document generation method, device, equipment and computer storage medium
CN110764748B (en) Code calling method, device, terminal and storage medium
CN108549538A (en) A kind of code detection method, device, storage medium and test terminal
CN115599386A (en) Code generation method, device, equipment and storage medium
US9696973B1 (en) Compilation cache with imports scanner
CN106156050B (en) Data processing method and device
CN111694992A (en) Data processing method and device
CN112000690B (en) Method and device for analyzing structured operation statement
CN112860265A (en) Method and device for detecting operation abnormity of source code database
CN117093261A (en) Code fault tolerance processing method and device based on abstract syntax tree in construction
CN113157258A (en) Information processing method, information processing apparatus, storage medium, and electronic device
CN113821496B (en) Database migration method, system, device and computer readable storage medium
CN109635175B (en) Page data splicing method and device, readable storage medium and electronic equipment
CN115729529A (en) Information processing method, device, equipment and storage medium
CN114996554A (en) Database query method and device, storage medium and electronic equipment
CN112130860B (en) JSON object analysis method and device, electronic equipment and storage medium
CN112711602B (en) Method and device for running stored procedure, database system and storage medium
CN114691104A (en) Language conversion method and device, electronic equipment and storage medium
CN112948264A (en) Test task execution method, device, system, storage medium and electronic device
CN112612474A (en) Product transplanting method and device, storage medium and electronic equipment
CN111796865A (en) Byte code file modification method and device, terminal equipment and medium
CN113778440B (en) Data processing method and device, electronic equipment and storage medium
CN116432185B (en) Abnormality detection method and device, readable storage medium and electronic equipment
CN113377674B (en) Log code adding method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination