CN110765008A - Data processing method and device - Google Patents

Data processing method and device Download PDF

Info

Publication number
CN110765008A
CN110765008A CN201910952784.0A CN201910952784A CN110765008A CN 110765008 A CN110765008 A CN 110765008A CN 201910952784 A CN201910952784 A CN 201910952784A CN 110765008 A CN110765008 A CN 110765008A
Authority
CN
China
Prior art keywords
data packet
return
preset
application program
annotation
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.)
Granted
Application number
CN201910952784.0A
Other languages
Chinese (zh)
Other versions
CN110765008B (en
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.)
Wangsu Science and Technology Co Ltd
Original Assignee
Wangsu Science and Technology 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 Wangsu Science and Technology Co Ltd filed Critical Wangsu Science and Technology Co Ltd
Priority to CN201910952784.0A priority Critical patent/CN110765008B/en
Publication of CN110765008A publication Critical patent/CN110765008A/en
Application granted granted Critical
Publication of CN110765008B publication Critical patent/CN110765008B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3624Software debugging by performing operations on the source code, e.g. via a compiler
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3636Software debugging by tracing the execution of the program
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses a data processing method and a device, which can ensure that an application program data packet applied to an online environment only contains an application method but not a debugging method by marking a preset annotation on the debugging method when the application program data packet is developed and deleting the method marked with the preset annotation before the application program data packet is applied to the online environment, thereby realizing the isolation of the development environment and the online environment in a real sense, reducing the data volume of user equipment occupied by the application program data packet on the basis of ensuring the safety of the debugging method, reducing the memory of the user equipment occupied during the operation and improving the user experience.

Description

Data processing method and device
Technical Field
The present invention relates to the field of data processing, and in particular, to a data processing method and apparatus.
Background
The Java language is a commonly used APP development language, an APP data packet developed by using the Java language comprises an application method and a debugging method, the application method is used for executing the online function of the APP, and the debugging method is used for debugging the application method. In general, the debugging method may include simulation data, a simulation method, and log information used by a developer in debugging an application method, and the simulation data, the simulation method, and the log information may have more internal private data or internal programs, so that before the APP packet is applied to an online environment, the debugging method should be hidden as much as possible, otherwise, not only the user experience is affected, but also the security of the private data in the debugging method cannot be guaranteed.
In an existing implementation manner, when a developer develops an APP packet, a decision statement may be set in each debugging method, a decision variable of the decision statement is identified by a global variable, if the decision variable is a first variable, the debugging method is not executed, and if the decision variable is a second variable, the debugging method is executed. Correspondingly, after the APP data packet is compiled, if the APP data packet is applied to an online environment, a developer can set a global variable as a first variable, and if the APP data packet is applied to a development environment, the developer can set the global variable as a second variable; in this way, after the APP packet is delivered to the online environment, since the global variable defaults to be the first variable, the debugging method in the APP packet is not executed when the APP packet is used. Therefore, by adopting the method, the APP data packet launched to the online environment still simultaneously comprises the application method and the debugging method, and only the debugging method is not executed when the APP data packet is used, so the method does not isolate the development environment from the online environment in the true sense, the data volume of the APP data packet launched to the online environment is large, and the APP data packet can occupy more memory of user equipment, thereby leading to poor user experience, and the user can modify the debugging method in the APP data packet in a reverse modification mode, and also can modify the execution process of the APP data packet by modifying the judgment variable, and the modifications can influence the normal use of the APP data packet, and the safety of the APP data packet cannot be guaranteed.
In summary, there is a need for a data processing method for solving the technical problems of low security and poor user experience caused by the prior art that a development environment and an online environment are isolated by using global variables and judgment statements.
Disclosure of Invention
The embodiment of the invention provides a data processing method and device, which are used for solving the technical problems of low safety and poor user experience caused by adopting global variables and judgment sentences to isolate a development environment from an online environment in the prior art.
In a first aspect, a data processing method provided in an embodiment of the present invention includes:
determining an application environment of an application program data packet, wherein the application program data packet is written by Java development language, if the application program data packet is determined to be applied to an online environment, determining a method marked with a preset annotation from the application program data packet, and deleting the method marked with the preset annotation from the application program data packet; the preset annotation is an annotation marked on a debugging method in the application program data packet when the user develops the application program data packet.
In the above design, by marking the preset annotation on the debugging method when the application program data packet is developed and deleting the method marked with the preset annotation before the application program data packet is applied to the online environment, the application program data packet applied to the online environment can only contain the application method and not contain the debugging method, so that the isolation of the development environment and the online environment in a real sense is realized, the data volume of the user equipment occupied by the application program data packet can be reduced on the basis of ensuring the safety of the debugging method, the memory of the user equipment occupied during the operation can be reduced, and the user experience is improved.
In one possible design, the determining the application environment of the application package includes: obtaining an environment parameter input by a user, if the environment parameter comprises a Release field, determining that the application program data packet is applied to the online environment, and if the environment parameter comprises a Debug field, determining that the application program data packet is applied to a development environment.
In the design, the application scene of the application program data packet can be set by a user through an interface, so that whether the debugging method in the application program data packet is deleted or not can be determined based on the application scene set by the user.
In one possible design, the method for determining that a preset annotation is marked in the application data packet includes: and aiming at any class in the application program data packet, obtaining annotation information of each method in the class, and if the annotation information of a certain method in the class comprises the preset annotation, determining that the method is the method marked with the preset annotation.
In the above design, by traversing each class and each method in each class in the application program data packet, annotation information of each method in the application program data packet can be accurately obtained, and a method marked with a preset annotation can be accurately determined, so that all debugging methods in the application level data packet are deleted before the application level data packet is applied to the online environment, and thus the accuracy of data processing can be improved.
In one possible design, the removing the method marked with the preset annotation from the application data packet includes: determining a return value type of the method marked with the preset annotation according to the definition byte code of the method marked with the preset annotation, and deleting the content byte code of the method marked with the preset annotation if the method marked with the preset annotation does not have the return value type; if the type of the return value of the method marked with the preset annotation is a digital type, replacing the content byte code of the method marked with the preset annotation with a first return byte code, wherein the first return byte code is used for indicating to return a preset numerical value; if the return value type of the method marked with the preset annotation is a Boolean type, replacing the content byte code of the method marked with the preset annotation with a second return byte code, wherein the second return byte code is used for indicating to return the preset Boolean value; and if the return value type of the method marked with the preset annotation is a character type, or the return value type of the method marked with the preset annotation is a type except a digital type, a character type and a Boolean type, replacing the content byte code of the method marked with the preset annotation with a third return byte code, wherein the third return byte code is used for indicating to return the preset character.
In the design, only the content byte codes of the debugging method are deleted, but the definition byte codes are not deleted, and the return value is set for the debugging method for deleting the content byte codes, so that the application method can be successfully quoted to the debugging method, the condition that the application program data packet is quoted and stuck in execution is avoided, and the sequential operation of the application program data packet in an online environment is ensured.
In a second aspect, an embodiment of the present invention provides a data processing apparatus, where the apparatus includes:
the determining module is used for determining the application environment of the application program data packet; the application program data packet is written by Java development language; if the application program data packet is determined to be applied to the online environment, determining a method marked with a preset annotation from the application program data packet; the preset annotation is an annotation marked on a debugging method in the application program data packet when the user develops the application program data packet;
and the processing module is used for deleting the method marked with the preset annotation from the application program data packet.
In one possible design, the determining module is specifically configured to: obtaining an environment parameter input by a user, if the environment parameter comprises a Release field, determining that the application program data packet is applied to the online environment, and if the environment parameter comprises a Debug field, determining that the application program data packet is applied to a development environment.
In one possible design, the determining module is specifically configured to: and aiming at any class in the application program data packet, obtaining annotation information of each method in the class, and if the annotation information of a certain method in the class comprises the preset annotation, determining that the method is the method marked with the preset annotation.
In one possible design, the processing module is specifically configured to: determining a return value type of the method marked with the preset annotation according to the definition byte code of the method marked with the preset annotation, and deleting the content byte code of the method marked with the preset annotation if the method marked with the preset annotation does not have the return value type; if the type of the return value of the method marked with the preset annotation is a digital type, replacing the content byte code of the method marked with the preset annotation with a first return byte code, wherein the first return byte code is used for indicating to return a preset numerical value; if the return value type of the method marked with the preset annotation is a Boolean type, replacing the content byte code of the method marked with the preset annotation with a second return byte code, wherein the second return byte code is used for indicating to return the preset Boolean value; and if the return value type of the method marked with the preset annotation is a character type, or the return value type of the method marked with the preset annotation is a type except a digital type, a character type and a Boolean type, replacing the content byte code of the method marked with the preset annotation with a third return byte code, wherein the third return byte code is used for indicating to return the preset character.
In a third aspect, an embodiment of the present invention provides a computing device, which includes at least one processing unit and at least one storage unit, where the storage unit stores a computer program, and when the program is executed by the processing unit, the processing unit is caused to execute the data processing method according to any of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program executable by a computing device, and when the program runs on the computing device, the computer program causes the computing device to execute the data processing method according to any of the first aspects.
These and other aspects of the invention are apparent from and will be elucidated with reference to the embodiments described hereinafter.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic diagram of a possible application scenario provided in an embodiment of the present invention;
fig. 2 is a schematic flow chart of a data processing method according to an embodiment of the present invention;
fig. 3 is a schematic application flow diagram of a data processing method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computing device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic diagram of a possible application scenario provided by an embodiment of the present invention, and as shown in fig. 1, a process of developing an application program may sequentially pass through a development phase, a compilation phase, and an application phase, where the development phase and the compilation phase are executed in a development environment and the application phase is executed in an application environment. In a specific implementation, in a development stage, a developer can write an application program data packet by using Java bytecode, where the application program data packet includes an application method and a debugging method, the application method includes a functional algorithm for implementing each function of the application program, and the debugging method includes a debugging algorithm written when debugging any application method, debugging data used, and an obtained debugging result (such as printed log information); further, in the embodiment of the present invention, a data processing apparatus is preset, and in the compiling stage, the data processing apparatus may perform data processing on the application program data packet generated in the development stage according to the application scenario, for example, if it is determined that the application program data packet is still applied to the development environment (for example, for version upgrade, fault repair, and the like), the application program data packet may be directly re-delivered to the development stage, and if it is determined that the application program data packet is applied to the application environment (for example, for installation on the user equipment), the data processing may be performed on the application program data packet first, and then the processed application program data packet is delivered to the application stage.
In the embodiment of the present invention, the data processing apparatus may be a hardware device, such as a data processing server, or may also be a software device, such as a plug-in, a framework, a dependency library, or the like; accordingly, the data processing device may be disposed inside the development environment, or may be disposed outside the development environment, and is not limited in particular.
It should be noted that, in the embodiment of the present invention, the debugging method may refer to any method that is not desired to be issued to the online environment, and is not limited to the debugging algorithm, the debugging data, and the debugging result described above, and the debugging method may be set by a person skilled in the art without limitation.
Based on the application scenario illustrated in fig. 1, fig. 2 is a schematic flowchart corresponding to a data processing method provided in an embodiment of the present invention, where the method is applied to a data processing apparatus, and the method includes:
step 201, determining the application environment of the application data packet.
In the embodiment of the invention, when a developer writes an application program data packet in a development stage, a preset annotation can be marked on a debugging method every time the developer writes one debugging method; the format of the preset annotation and the position of the preset annotation label may be set by those skilled in the art according to experience, and are not limited specifically. For example, if the preset annotation is @ Debug and the debugging method is testMethod, the preset annotation can be labeled as follows:
Figure BDA0002226296680000071
therefore, after the application program data packet in the development stage is written, each debugging method in the application program data packet can be marked with a preset annotation, and the development process of the application program enters the debugging stage from the development stage.
In a possible implementation manner, the data processing device can be automatically triggered when the debugging stage is started, so that after the data processing device detects that the debugging stage is entered, a developer can be prompted to input the environmental parameters; the prompting mode may be various, for example, the prompting mode may be a command line prompting mode, or may also be a text box prompting mode, or may also be a voice prompting mode, which is not limited specifically. Further, the data processing apparatus may obtain an environment parameter input by a user through an interface of a current compilation task, and may determine that the application package is applied to the online environment if the environment parameter includes a Release field, for example, transformlases within a mufpluginforrelease, and may determine that the application package is applied to the development environment if the environment parameter includes a Debug field, for example, transformlases within a mufpluginfordebug.
In the implementation mode, the application scene of the application program data packet can be set by a user through an interface, so that whether the debugging method in the application program data packet is deleted or not can be determined based on the application scene set by the user, the design meets the actual requirement better, and the user experience is better.
In one example, after acquiring the environment parameters input by the user, the data processing apparatus may analyze only the end field of the environment parameters, and if the end field includes Release, may determine that the application packet is applied to the online environment, and if the end field includes Debug, may determine that the application packet is applied to the development environment. In this example, by analyzing the end field, the data processing amount of the data processing apparatus can be reduced, and the data processing efficiency can be improved.
Step 202, if it is determined that the application data packet is applied to the online environment, determining a method marked with a preset annotation from the application data packet.
In the embodiment of the present invention, the data processing apparatus may be a Gradle plug-in developed based on an Automatic Storage Management (ASM) technology, and since the ASM technology is an operation framework of Java bytecode, the data processing apparatus may read a class in the Java bytecode, change a behavior of the class in the Java bytecode, analyze Java bytecode information of the class, and generate a custom new class.
Based on this, in a possible implementation manner, if it is determined that the application data packet is applied to the online environment, the data processing apparatus may traverse each class in the application data packet, and obtain annotation information of each method in each class, and if annotation information of a method (for example, a first method) in a certain class includes a preset annotation, it may be determined that the first method is a method marked with the preset annotation. Note information of each method may be represented in the form of an array, or may be represented in other forms, and is not limited in particular.
In the implementation mode, by traversing each class in the application program data packet and each method in each class, annotation information of each method in the application program data packet can be accurately obtained, and the method marked with the preset annotation can be accurately determined, so that all debugging methods in the application level data packet are deleted before the application level data packet is applied to the online environment, and the accuracy of data processing can be improved.
Step 203, deleting the method marked with the preset annotation from the application program data packet.
In the embodiment of the present invention, for any method marked with a preset annotation, both the definition bytecode and the content bytecode of the method may be directly deleted, or only the content bytecode of the method may be deleted, and the definition bytecode of the method is retained, which is not particularly limited. Wherein, the definition byte code of the method refers to the part of code defining the name of the method, and the content byte code of the method refers to the part of code realizing the function of the method.
For example, if the byte code of a certain method is:
public void testMethod(){……}
the definition bytecode of the method is "public void testMethod () { }" and the content bytecode of the method is "… …".
In the embodiment of the invention, if only the content byte code of the method is deleted, the return value of the method is required to be set, otherwise, when other methods call the method, operation errors of other methods are caused because the return value is not obtained, and thus the operation of the application program is influenced. In specific implementation, the data processing apparatus may determine the return value type of the method according to the definition bytecode of the method, then set the corresponding content bytecode according to the return value type of the method, and update the original content bytecode in the method using the content bytecode; the return value types of the method may include five cases, namely a no-return value type, a numeric type, a character type, a boolean type and other types, and the execution mode of each case is described as follows:
situation one
In case one, if the method does not have a return value type, the content bytecode in the method may be directly deleted, and the return value of the method may not be set.
For example, the bytecode of a certain method is:
public void testMethod(){……}
according to the definition bytecode "public void testMethod () { }" of the method, the return value type of the method can be determined to be "void", which means that the method does not have the return value type, so that the content bytecode "… …" in the method can be deleted directly, and thus, the method is updated as follows:
public void testMethod(){}
situation two
In case two, if the type of the return value of the method is a numeric type, the content bytecode in the method can be replaced with a first return bytecode, where the first return bytecode is used to indicate that a preset numeric value is returned. The number type may be any one of byte type, short integer short, int, long integer long, floating point float, and double precision floating point double.
For example, when the default value is 0, if the byte code of a certain method is:
then it can be determined that the type of the Return value of the method is "int" according to the definition bytecode "public int testMethod () }" of the method, which indicates that the type of the Return value of the method is a number type, so that the first Return bytecode "Return 0" can be set, and the first Return bytecode "Return 0" can be used to replace "… …" in the method; return … … ", so the method is updated as:
Figure BDA0002226296680000101
situation three
In case three, if the type of the return value of the method is boolean, the content bytecode of the method may be replaced with a second return bytecode, the second return bytecode indicating that a preset boolean value is returned; wherein the boolean type may be a boolean type borolean.
For example, if the predetermined boolean value is false, the byte code of a certain method is:
Figure BDA0002226296680000102
then according to the definition bytecode "public building testMethod () }" of the method, the Return value type of the method can be determined to be "building", which indicates that the Return value type of the method is boolean type, so that the second Return bytecode "Return false" can be set, and the second Return bytecode "Return false" can be used to replace "… …" in the method; return … … ", so the method is updated as:
Figure BDA0002226296680000103
situation four
In case four, if the return value type of the method is a character type, the content bytecode of the method may be replaced with a third return bytecode, where the third return bytecode is used to indicate to return a preset character; the character type may be a character type char.
For example, when the predetermined boolean value is null, if the byte code of a certain method is:
Figure BDA0002226296680000111
then according to the definition bytecode "public char testMethod () }" of the method, the Return value type of the method can be determined to be "char", which indicates that the Return value type of the method is character type, so that a third Return bytecode "Return null" can be set, and the third Return bytecode "Return null" can be used to replace "… …" in the method; return … … ", so the method is updated as:
Figure BDA0002226296680000112
situation five
In case five, if the return value type of the method is other than the number type, the character type, and the boolean type, a third return bytecode for indicating that a preset character is returned may be used instead of the content bytecode of the method. Wherein, the other type may refer to any one of class and method, and the fifth case may be implemented specifically with reference to the fourth case, which is not described herein again.
In the embodiment of the invention, only the content byte codes of the debugging method are deleted without deleting the definition byte codes, and the return value is set for the debugging method for deleting the content byte codes, so that the application method can be smoothly quoted to the debugging method, the condition that the application program data packet is quoted and stuck in execution is avoided, and the sequential operation of the application program data packet in an online environment is ensured.
In the embodiment of the present invention, the data processing apparatus may refer to a Gradle plug-in developed based on an ASM technology, and the data processing method illustrated in fig. 2 is described below from the perspective of flow implementation.
Fig. 3 is a schematic flow implementation diagram of a data processing method according to an embodiment of the present invention, and the method illustrated in fig. 3 may be applied to Development, internal test, and version release of an android application program or a Software Development Kit (SDK) to provide a secure code isolation environment for an application. As shown in fig. 3, the method includes:
step 301, preparation phase, plug-in is introduced in project engineering.
In specific implementation, a Jar data packet of the plug-in can be copied to project engineering needing to be implemented, and then the plug-in the embodiment of the invention is introduced by adding ' application plugin ' plug-in name '; for example, if the plug-in name in the embodiment of the present invention is S, the plug-in S in the embodiment of the present invention can be introduced into the project engineering by adding "application plugin:" S' ".
Step 302, in the development phase, writing each application method and each debugging method in the application program to obtain an application program data packet.
Step 303, for any written method, determining whether the method belongs to a debugging method which is not wanted to be issued to the online environment, if so, executing step 304, and if not, executing step 305.
Step 304, add preset annotations to debug methods that do not want to be published to the online environment.
Step 305, no processing.
Step 306, in the compiling stage, after the preset annotation is added to each debugging method in the application program data packet, the plug-in is automatically triggered.
Step 307, the plug-in traverses all methods of each class in the application package and obtains annotation information for each method.
Step 308, for any method, determining whether the annotation information of the method includes a preset annotation, if so, indicating that the method is applied to the online environment, and therefore, executing step 309, and if not, indicating that the method is applied to the development environment, and therefore, executing step 310.
Step 309, determining the return value type of the method according to the definition bytecode of the method, if the return value type exists, setting a corresponding return bytecode according to the return value type, replacing the content bytecode of the method with the return bytecode, and if the return value type does not exist, deleting the content bytecode of the method.
Step 310, no processing.
In the above embodiment of the present invention, an application environment of an application data packet is determined, where the application data packet is written in Java development language, and if it is determined that the application data packet is applied to an online environment, a method marked with a preset annotation is determined from the application data packet, and the method marked with the preset annotation is deleted from the application data packet; the preset annotation is an annotation marked on a debugging method in the application program data packet when the user develops the application program data packet. In the embodiment of the invention, the preset annotation is marked on the debugging method when the application program data packet is developed, and the method marked with the preset annotation is deleted before the application program data packet is applied to the online environment, so that the application program data packet applied to the online environment only contains the application method but not the debugging method, the isolation of the development environment and the online environment in real sense is realized, the data volume of the user equipment occupied by the application program data packet can be reduced on the basis of ensuring the safety of the debugging method, the memory of the user equipment occupied during the operation is reduced, and the user experience is improved.
In view of the above method flow, an embodiment of the present invention further provides a data processing apparatus, and specific contents of the apparatus may be implemented with reference to the above method.
Fig. 4 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention, including:
a determining module 401, configured to determine an application environment of the application package; the application program data packet is written by Java development language; if the application program data packet is determined to be applied to the online environment, determining a method marked with a preset annotation from the application program data packet; the preset annotation is an annotation marked on a debugging method in the application program data packet when the user develops the application program data packet;
and the processing module 402 is configured to delete the method labeled with the preset annotation from the application data packet.
Optionally, the determining module 401 is specifically configured to:
acquiring an environmental parameter input by a user;
determining that the application package is applied to the online environment if the environment parameter includes a Release field, such as transformlasses withmufpluginforrelease, and determining that the application package is applied to a development environment if the environment parameter includes a Debug field, such as transformlasses withmufpluginfordistribution.
Optionally, the determining module 401 is specifically configured to:
and aiming at any class in the application program data packet, obtaining annotation information of each method in the class, and if the annotation information of a certain method in the class comprises the preset annotation, determining that the method is the method marked with the preset annotation.
Optionally, the processing module 402 is specifically configured to:
determining the type of a return value of the method marked with the preset annotation according to the definition byte code of the method marked with the preset annotation;
if the method marked with the preset annotation does not have the return value type, deleting the content byte code of the method marked with the preset annotation; if the type of the return value of the method marked with the preset annotation is a digital type, replacing the content byte code of the method marked with the preset annotation with a first return byte code, wherein the first return byte code is used for indicating to return a preset numerical value; if the return value type of the method marked with the preset annotation is a Boolean type, replacing the content byte code of the method marked with the preset annotation with a second return byte code, wherein the second return byte code is used for indicating to return the preset Boolean value; and if the return value type of the method marked with the preset annotation is a character type, or the return value type of the method marked with the preset annotation is a type except a digital type, a character type and a Boolean type, replacing the content byte code of the method marked with the preset annotation with a third return byte code, wherein the third return byte code is used for indicating to return the preset character.
From the above, it can be seen that: in the above embodiment of the present invention, an application environment of an application data packet is determined, where the application data packet is written in Java development language, and if it is determined that the application data packet is applied to an online environment, a method marked with a preset annotation is determined from the application data packet, and the method marked with the preset annotation is deleted from the application data packet; the preset annotation is an annotation marked on a debugging method in the application program data packet when the user develops the application program data packet. In the embodiment of the invention, the preset annotation is marked on the debugging method when the application program data packet is developed, and the method marked with the preset annotation is deleted before the application program data packet is applied to the online environment, so that the application program data packet applied to the online environment only contains the application method but not the debugging method, the isolation of the development environment and the online environment in real sense is realized, the data volume of the user equipment occupied by the application program data packet can be reduced on the basis of ensuring the safety of the debugging method, the memory of the user equipment occupied during the operation is reduced, and the user experience is improved.
Based on the same inventive concept, an embodiment of the present invention further provides a computing device, as shown in fig. 5, where the computing device includes at least one processor 501 and a memory 502 connected to the at least one processor, and a specific connection medium between the processor 501 and the memory 502 is not limited in this embodiment of the present invention, and the processor 501 and the memory 502 are connected through a bus in fig. 5 as an example. The bus may be divided into an address bus, a data bus, a control bus, etc.
In the embodiment of the present invention, the memory 502 stores instructions executable by the at least one processor 501, and the at least one processor 501 may execute the steps included in the foregoing data processing method by executing the instructions stored in the memory 502.
The processor 501 is a control center of the computing device, and may be connected to various parts of the computing device through various interfaces and lines, and implement data processing by executing or executing instructions stored in the memory 502 and calling data stored in the memory 502. Optionally, the processor 501 may include one or more processing units, and the processor 501 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application program, and the like, and the modem processor mainly processes an issued instruction. It will be appreciated that the modem processor described above may not be integrated into the processor 501. In some embodiments, processor 501 and memory 502 may be implemented on the same chip, or in some embodiments, they may be implemented separately on separate chips.
The processor 501 may be a general-purpose processor, such as a Central Processing Unit (CPU), a digital signal processor, an Application Specific Integrated Circuit (ASIC), a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof, configured to implement or perform the methods, steps, and logic blocks disclosed in the embodiments of the present invention. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the data processing embodiments may be embodied directly in a hardware processor, or in a combination of the hardware and software modules within the processor.
Memory 502, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The Memory 502 may include at least one type of storage medium, and may include, for example, a flash Memory, a hard disk, a multimedia card, a card-type Memory, a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Programmable Read Only Memory (PROM), a Read Only Memory (ROM), a charged Erasable Programmable Read Only Memory (EEPROM), a magnetic Memory, a magnetic disk, an optical disk, and so on. The memory 502 is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The memory 502 of embodiments of the present invention may also be circuitry or any other device capable of performing a storage function to store program instructions and/or data.
It should be noted that the computing device illustrated in fig. 5 may be a terminal device, or may also be a backend device, or may also be another device, which is not limited.
Based on the same inventive concept, embodiments of the present invention also provide a computer-readable storage medium storing a computer program executable by a computing device, where the computer program is configured to cause the computing device to execute the data processing method described in any of fig. 2 or fig. 3 when the computer program runs on the computing device.
It should be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (10)

1. A method of data processing, the method comprising:
determining an application environment of an application program data packet; the application program data packet is written by Java development language;
if the application program data packet is determined to be applied to the online environment, determining a method marked with a preset annotation from the application program data packet; the preset annotation is an annotation marked on a debugging method in the application program data packet when the user develops the application program data packet;
and deleting the method marked with the preset annotation from the application program data packet.
2. The method of claim 1, wherein determining the application context of the application package comprises:
acquiring an environmental parameter input by a user;
and if the environment parameter contains a Release field, determining that the application program data packet is applied to the online environment, and if the environment parameter contains a Debug field, determining that the application program data packet is applied to a development environment.
3. The method according to claim 1, wherein the determining of the application data packet with the preset annotation includes:
and aiming at any class in the application program data packet, obtaining annotation information of each method in the class, and if the annotation information of a certain method in the class comprises the preset annotation, determining that the method is the method marked with the preset annotation.
4. The method according to any one of claims 1 to 3, wherein the deleting the method marked with the preset annotation from the application program data packet comprises:
determining the type of a return value of the method marked with the preset annotation according to the definition byte code of the method marked with the preset annotation;
if the method marked with the preset annotation does not have the return value type, deleting the content byte code of the method marked with the preset annotation; if the type of the return value of the method marked with the preset annotation is a digital type, replacing the content byte code of the method marked with the preset annotation with a first return byte code, wherein the first return byte code is used for indicating to return a preset numerical value; if the return value type of the method marked with the preset annotation is a Boolean type, replacing the content byte code of the method marked with the preset annotation with a second return byte code, wherein the second return byte code is used for indicating to return the preset Boolean value; and if the return value type of the method marked with the preset annotation is a character type, or the return value type of the method marked with the preset annotation is a type except a digital type, a character type and a Boolean type, replacing the content byte code of the method marked with the preset annotation with a third return byte code, wherein the third return byte code is used for indicating to return the preset character.
5. A data processing apparatus, characterized in that the apparatus comprises:
the determining module is used for determining the application environment of the application program data packet; the application program data packet is written by Java development language; if the application program data packet is determined to be applied to the online environment, determining a method marked with a preset annotation from the application program data packet; the preset annotation is an annotation marked on a debugging method in the application program data packet when the user develops the application program data packet;
and the processing module is used for deleting the method marked with the preset annotation from the application program data packet.
6. The apparatus of claim 5, wherein the determining module is specifically configured to:
acquiring an environmental parameter input by a user;
and if the environment parameter contains a Release field, determining that the application program data packet is applied to the online environment, and if the environment parameter contains a Debug field, determining that the application program data packet is applied to a development environment.
7. The apparatus of claim 5, wherein the determining module is specifically configured to:
and aiming at any class in the application program data packet, obtaining annotation information of each method in the class, and if the annotation information of a certain method in the class comprises the preset annotation, determining that the method is the method marked with the preset annotation.
8. The apparatus according to any one of claims 5 to 7, wherein the processing module is specifically configured to:
determining the type of a return value of the method marked with the preset annotation according to the definition byte code of the method marked with the preset annotation;
if the method marked with the preset annotation does not have the return value type, deleting the content byte code of the method marked with the preset annotation; if the type of the return value of the method marked with the preset annotation is a digital type, replacing the content byte code of the method marked with the preset annotation with a first return byte code, wherein the first return byte code is used for indicating to return a preset numerical value; if the return value type of the method marked with the preset annotation is a Boolean type, replacing the content byte code of the method marked with the preset annotation with a second return byte code, wherein the second return byte code is used for indicating to return the preset Boolean value; and if the return value type of the method marked with the preset annotation is a character type, or the return value type of the method marked with the preset annotation is a type except a digital type, a character type and a Boolean type, replacing the content byte code of the method marked with the preset annotation with a third return byte code, wherein the third return byte code is used for indicating to return the preset character.
9. A computing device comprising at least one processing unit and at least one memory unit, wherein the memory unit stores a computer program that, when executed by the processing unit, causes the processing unit to perform the method of any of claims 1 to 4.
10. A computer-readable storage medium storing a computer program executable by a computing device, the program, when executed on the computing device, causing the computing device to perform the method of any of claims 1 to 4.
CN201910952784.0A 2019-10-09 2019-10-09 Data processing method and device Active CN110765008B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910952784.0A CN110765008B (en) 2019-10-09 2019-10-09 Data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910952784.0A CN110765008B (en) 2019-10-09 2019-10-09 Data processing method and device

Publications (2)

Publication Number Publication Date
CN110765008A true CN110765008A (en) 2020-02-07
CN110765008B CN110765008B (en) 2023-08-18

Family

ID=69331010

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910952784.0A Active CN110765008B (en) 2019-10-09 2019-10-09 Data processing method and device

Country Status (1)

Country Link
CN (1) CN110765008B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112667481A (en) * 2020-12-31 2021-04-16 中国建设银行股份有限公司 Data collection kit, method and device
CN116225576A (en) * 2023-05-08 2023-06-06 成都赛力斯科技有限公司 Application program data environment switching method and device, electronic equipment and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6675375B1 (en) * 2000-04-28 2004-01-06 Sun Microsystems, Inc. Method and apparatus for optimized multiprocessing in a safe language
US20060294502A1 (en) * 2005-06-22 2006-12-28 Microsoft Corporation Programmable annotation inference
CN109508249A (en) * 2018-11-15 2019-03-22 厦门美图之家科技有限公司 Collapse processing method, apparatus and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6675375B1 (en) * 2000-04-28 2004-01-06 Sun Microsystems, Inc. Method and apparatus for optimized multiprocessing in a safe language
US20060294502A1 (en) * 2005-06-22 2006-12-28 Microsoft Corporation Programmable annotation inference
CN109508249A (en) * 2018-11-15 2019-03-22 厦门美图之家科技有限公司 Collapse processing method, apparatus and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
马玉英: "嵌入式系统开发工具及RTOS平台" *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112667481A (en) * 2020-12-31 2021-04-16 中国建设银行股份有限公司 Data collection kit, method and device
CN112667481B (en) * 2020-12-31 2024-05-10 中国建设银行股份有限公司 Data acquisition tool kit, method and equipment
CN116225576A (en) * 2023-05-08 2023-06-06 成都赛力斯科技有限公司 Application program data environment switching method and device, electronic equipment and medium

Also Published As

Publication number Publication date
CN110765008B (en) 2023-08-18

Similar Documents

Publication Publication Date Title
US5202889A (en) Dynamic process for the generation of biased pseudo-random test patterns for the functional verification of hardware designs
CN111796831B (en) Compiling method and device for multi-chip compatibility
CN107643893B (en) Program detection method and device
US9639343B2 (en) Method for altering execution of a program, debugger, and computer-readable medium
US9129137B2 (en) Method, computer program and device for providing security for intermediate programming code for its execution by a virtual machine
CN109032612B (en) Interface calling method and device of hybrid application and computer readable storage medium
CN110765008B (en) Data processing method and device
CN115617687A (en) Program instrumentation method, apparatus, device and storage medium
CN111625225A (en) Program specified data output method and device
CN103365772B (en) Software test automatic evaluation device and method
CN114428642A (en) Random instruction generation environment based on novel processor architecture
CN110688320B (en) Global variable detection method and device and terminal equipment
CN117215558A (en) Visual software development method, device, equipment and medium for android
CN110688198B (en) System calling method and device and electronic equipment
CN111209135A (en) Log processing method and device
US9436587B2 (en) Test context generation
US11200126B2 (en) Utilizing translation tables for testing processors
CN111444456B (en) Style editing method and device and electronic equipment
CN112527657B (en) Method and equipment for automatic pile insertion in unit test
CN113031956A (en) Program compiling method and device and program running method and device
CN113791767B (en) Byte code modification method and device
CN116467131B (en) ECC function verification method, device, medium and equipment of processor
CN114138588B (en) Method, system, equipment and medium for deriving debug information of controller
CN115470151B (en) Application operation analysis method, computing device and storage medium
CN112527660B (en) Static detection method and device for codes

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
GR01 Patent grant
GR01 Patent grant