Soot-based Java Method name generation report

Source: Internet
Author: User
Tags xsl xsl file

0. generating XML format Files

The author uses soot the Java file parsing to generate the XML format document, the concrete operation flow no longer to repeat. This article discusses the purpose of the execution results. The first time I used the Java file is as follows: file name Test.java

After parsing with soot, generate an XML file that looks like this:

1. linking XML documents with XSL style tables

It's easy to see that this is a common XML file, and then I use the Altova XMLSpy tool to write an XSL file corresponding to an XML file, and to link an XSL style sheet to an XML document. You can generate a list of method names as shown below, and the files are previewed in HTML format:

2. Second set of instance tests

The author then tests another Java file in this way, unlike the previous one, which has three classes in the Java file.

Then when the Java file is converted into an XML file, the author unexpectedly discovers that the generated XML file is not one but three:

Next, I randomly select an XML file extraction method name, take the first mycode.forst.xml as an example, the result is as follows:

You can see that these groups of methods belong to the same class, namely Mycode.first

The second XML file is the same:

3.0 Summary

From the above two examples you can see that soot parsing a Java file, the entire Java file is divided into classes to separate the parsing. The method is re-parsed in each class file. Due to the limitations of the author's knowledge and the limited type of XML file, the relationship between methods is difficult to parse through XML file. However, after their own inquiries and attempts, the following points to their own shortcomings in the solution.

3.1 Summary

Java is encapsulated by the class, the relationship between classes and classes, in the above example, does not reflect the relationship between classes and classes, and the transformation of the dependencies between classes is a good way to do is UML diagram. As follows:

3.2 Summary

In the above example, using soot to convert Java source code into an XML file does not respond well to the various internal calls in the class, one way to solve this problem is to use soot to generate CFGS, which is the control flow graph. As an example of the above Test.java, using Soot.jar to parse the file into a control flow graph, as shown below, is a good reflection of the invocation path of the function class:

3.3 Summary

Next work and direction:

On the basis of the above results, the author will further enrich their use cases. Then find the relationships between the various methods in the Java class. The train of thought will not dwell on it.

If the picture is not clear, you can download the PDF format:

Link: https://pan.baidu.com/s/1mhXUCac Password: sq27

Soot-based Java Method name generation report

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.