SDA SE Wiki

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

User Tools

Site Tools



identT(#id, #parent, #encl, #symbol)

Represents an access to

  1. a method parameter or
  2. a local variable or
  3. 'this' or
  4. 'super'
Note that identT represents no field accesses. Field accesses are represented by fieldAccessT.
Changes in JTransformer 4.0
  • Removed “name” argument
  • The access to the Java constant 'null' is not longer represented as an identT but as a literalT
  • In JTransformer versions < 2.6.0 identT also represented class literals, and qualified type names. Class literals are now modeled with selectT. Qualified type names in static method calls and static field accesses are now represented with staticTypeRefT.

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 method, constructor, class initializer or field definition that contains this (pseudo-)variable access.

#symbol: localT, paramT, classT
ID of the referenced local variable, parameter or class.

  • The access to 'super' references as symbol the ID of the superclass.
  • The access to 'this' references the ID of the class of which 'this' is an instance:
 identT(..., ..., ..., 'null').          % access to 'null'
 identT(..., ..., ..., #idOfParamT).     % access to parameter
 identT(..., ..., ..., #idOfLocalT).     % access to local var
 identT(..., ..., ..., #idOfSuperclass). % access to 'super'
 identT(..., ..., ..., #idOfOwnClass).   % access to 'this'

An access to 'super' that refers to the superclass Class is detected by

access_to_super(Id,Class) :-
  identT(Id, _, _, Class),               % an identifier
  classT(Class, _,_,_),                  % that references a class
  not( ast_ancestor(Id, Class)).         % that does not contain the identifier

An explicit access to 'this' in class Class is detected by

access_to_this(Id,Class) :-
  identT(Id, _, _, Class),               % an identifier
  classT(Class, _,_,_),                  % that references a class
  ast_ancestor(Id, Class).               % that contains the identifier

Sample Java Code

public Object m(int i) {
	int j=0;
        ...
        x = i + j;
        ...
        Object o = super.abc;
        ...
        return this;
}

Its PEF Representation

For better readability IDs are represented by symbolic constants prefixed with #.

methodT(#encl, ..., 'm', [], #refToObject, [], ...).
  paramT(#symbol1, ..., #refToInt, 'i').
  localT(#symbol2, ..., #encl, #refToInt, 'j', ...).
...
operationT(#parent, ..., #encl, [#id1, #id2], '+', 0).
  identT(#id1, #parent, #encl, #symbol1).
  identT(#id2, #parent, #encl, #symbol2).
...
localT(#symbol3, ..., #encl, #refToObject, 'o', #get).
  getFieldT(#get, #symbol3, #encl, #id3, abc, #abc).
    identT(#id3, #get, #encl, #superclass).

...
returnT(#retid, ..., #encl, #ident).
  identT(#ident, #retid, #encl, #classOfThis).

AST Specification

ast_node_type_spec(identT,[
     ast_arg(id,      mult(1,1,no ), id,  [identT]),
     ast_arg(parent,  mult(1,1,no ), id,  [id]), 
     ast_arg(encl,    mult(1,1,no ), id,  [methodT, constructorT, classInitializerT, fieldT]), 
     ast_arg(ref,     mult(1,1,no ), id,  [classT,localT,paramT]) 
]).
research/jtransformer/api/java/pefs/4.0/identt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2025