Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
Represents the try statement.
#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.
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()); } }
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_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]) ]).