Automated Formal Static Analysis and Retrieval of Source Code - JKU
Automated Formal Static Analysis and Retrieval of Source Code - JKU
Automated Formal Static Analysis and Retrieval of Source Code - JKU
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
54 CHAPTER 4. CONCLUSIONS<br />
tions. After the retrieval <strong>of</strong> their content, they have to be transformed into Theorema syntax <strong>and</strong><br />
sent as input to FwdVCG which generates the corresponding verification conditions.<br />
Retrieving Methods <strong>and</strong> Specifications. The attempts <strong>of</strong> retrieving the methods together<br />
with their specification is above the capabilities <strong>of</strong> the tagger. The problem is solved by the parser<br />
which is able to retrieve JML specifications <strong>and</strong> methods body from the Java source code files.<br />
XForm Queries for Abstract Syntax Tree Transformations. For querying <strong>and</strong> transforming<br />
the abstract syntax trees for source code files we use XForm. The language allows queries for<br />
retrieving meaningful metadata about the hit-types, but we are interested in the queries for special<br />
type comments retrieval (JML-like specification) <strong>and</strong> content <strong>of</strong> the methods.<br />
The language XForm has a syntax <strong>and</strong> semantics similar to XPath 2.0 XML query language,<br />
but additional has support for abstract syntax trees (AST) transformations <strong>and</strong> queries.<br />
An XForm query is composed <strong>of</strong> a serie <strong>of</strong> one or more comma-separated expressions, each<br />
returning a sequence <strong>of</strong> tree items. All XForm queries generate ordered sets <strong>of</strong> tree items that<br />
match the specified query template. A tree item may be a node within the AST, a string, or null.<br />
Nested sequences are not allowed.<br />
The model <strong>of</strong> tree built by the parser is in the Figure 4.1<br />
Figure 4.1: The Model <strong>of</strong> the Syntax Tree<br />
When parsing a Java source code file, the model <strong>of</strong> AST built has the disadvantage that the<br />
comment (specification) node is not located right before or after the method declaration; they<br />
are inserted as nodes on the same level as the class declaration node. Because <strong>of</strong> this drawback<br />
the AST’s processing <strong>and</strong> the retrieval <strong>of</strong> the right specification for a method necessitates a long<br />
processing time <strong>and</strong> a complex algorithm that associates to a method the right specification.<br />
The implementation details for retrieving the content <strong>of</strong> the methods <strong>and</strong> the specifications<br />
can be found in [Luk08].