newClassT (#id, #parent, #encl, #constructor, [#arg_1,...], #ref, #anonClDef, #encltype)

Represents the class instance creation expression.

Arguments

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

#parent: id
ID of the parent node.

#encl: methodT, constructorT, classInitializerT, fieldT
ID of the fact that represents the enclosing element.

#constructor: constructorT, null
ID of the constructor invoked by this expression. If the referenced constructor is a anonymous class constructor #constructor is 'null'.

[#arg_1,…]: expression
list of argument expressions in this class instance creation expression.

#ref: classT
The class instantiated by this constructor call. ← Changed in JTransformer 2.6.0

#anonClDef: classT, null
the anonymous class declaration introduced by this class instance creation expression, if it has one.

#encltype: classT, newClassT, null
ID of the inner or member class constructor or ID of the anonymous class.

Sample Java Code

void myFunction(){
	String mySting = new String();
}

Its PEF Representation

methodT(#encl, ..., 'myFunction', [], type(basic, void, 0), [], ...).
localT(#parent, ..., #encl, type(class, ..., 0), 'mySting', #id).
newClassT(#id, #parent, #encl, #constructor, [], 10005, 'null', 'null').

AST Specification

ast_node_def('Java',newClassT,[
     ast_arg(id,      mult(1,1,no ), id,  [newClassT]), % <-- convention!!!
     ast_arg(parent,  mult(1,1,no ), id,  [id]), % <-- convention!!!
     ast_arg(encl,    mult(1,1,no ), id,  [methodT, constructorT, classInitializerT, fieldT]),
     ast_arg(constr,  mult(0,1,no), id,  [constructorT, nullType]),
     ast_arg(args,    mult(0,*,ord), id,  [expressionType]),
     ast_arg(ref,     mult(0,1,no), id,  [classT]), % <-- changed in JT 2.5.1 [identT, selectT]),
     ast_arg(anonClDef,mult(0,1,no), id,  [classT, nullType]),
     ast_arg(encltype,mult(0,1,no), id, [classT, newClassT, nullType])
]).
Last modified: 2014/04/11 14:30
 
*