@deprecated with JT 2.8.0 see methodT for current representation


methodDefT(#id, #classDef, 'name', [#param_1,...], TYPE, [#exception_1,...], #body)

represents the method, constructor or an initializer declaration.

Arguments

#id:
the unique ID assigned to this fact.

#classDef: classDefT
ID of the parent/declaring class.

'name':
1) name of the method declared in this method declaration or
2) '<init>' (constructor declaration) or
3) '<clinit>' (initializer declaration).

[#param_1,…]: paramDefT
list of IDs of the method parameters.

TYPE:
is a valid typeterm.

[#exception_1,…]: classDefT
list of IDs of the thrown exceptions.

#body: blockT, null
ID of the block.

Sample Java Source

class HelloWorld  {                                                              //classDefT
  public static void main(String[] args){                                        //corresnponding method to methodDefT
    System.out.println("Hello World! I've got a message for you: " + message);   //bodyT
  }
}

Its PEF Representation

classDefT(#parent, 'null', 'HelloWorld', [fqn('HelloWorld', '<init>', []), ..., #id]). 
methodDefT(#id, #parent, 'main', ..., type(basic, void, 0), [], #body).
blockT(#body, #id, #id, ...).

AST Specification

ast_node_def('Java',methodDefT,[
     ast_arg(id,      mult(1,1,no ), id,  [methodDefT]), % <-- convention!!!
     ast_arg(parent,  mult(1,1,no ), id,  [classDefT]), 
     ast_arg(name,    mult(1,1,no ), attr,[atom]),
     ast_arg(params,  mult(0,*,ord), id,  [paramDefT]),
     ast_arg(type,    mult(0,1,no),  attr,[typeTermType,nullType]),  % 0, if constructor definition
     ast_arg(excepts, mult(0,*,ord), id,  [classDefT]), %ord, only for compatibility with current PEF represenation: detection of lists
     ast_arg(body,    mult(0,1,no),  id,  [blockT,nullType])
% The following pseudo-components are now in ast_relation(Java, Reltype, Defs):  
%     ast_arg(hasModif,mult(0,*,no),  attr,[atom])     
]).
research/jtransformer/api/java/pefs/old/methoddeft.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019