SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools



tryT (#id, #parent, #encl, #body, [#catcher_1,...], #finalizer)

Represents the try statement.

Arguments

#id: id
the unique ID assigned to this fact.

#parent: id
ID of the parent node.

#encl: methodT, constructorT, classInitializerT
ID of the enclosing method declaration.

#body: blockT
ID of the body, guarded by the try-catch statement.

[#catcher_1,…]: catchT
list of the exception catchers.

#finalizer: blockT,null
ID of the block containing the statements of the finally part.

Sample Java Source

void myTryCatch() {
	String filename = "/Users/myfilename";
	try { // corresponding code line to tryT
		new File(filename).createNewFile();
	} catch (IOException e) {//catchT
		System.out.println("Unable to create " + filename + ": "+ e.getMessage());
	}
}

Its PEF Representation

tryT(#id, #parent, #enclMethod, #body, [#catcher_1], 'null').
blockT(#parent, #enclMethod, #enclMethod, [..., #id]).
methodT(#enclMethod, ..., 'myTryCatch', [], type(basic, void, 0), [], #parent).
blockT(#body, #id, #enclMethod, [...]).
catchT(#catcher_1, #id, #enclMethod, ..., ...).

AST Specification

ast_node_def('Java',tryT,[
     ast_arg(id,     mult(1,1,no ), id, [tryT]), % <-- convention!!!
     ast_arg(parent, mult(1,1,no ), id, [id]), % <-- convention!!!
     ast_arg(encl,   mult(1,1,no ), id, [methodT, constructorT, classInitializerT]),
     ast_arg(block,  mult(1,1,no ), id, [blockT]),
     ast_arg(catchers,mult(1,*,ord), id, [catchT]),
     ast_arg(finalize,mult(0,1,no), id, [blockT,nullType])
]).
research/jtransformer/api/java/pefs/2.9/tryt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2024