SDA SE Wiki

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

User Tools

Site Tools


Changes JTranformer 2.5 -> 2.6

Redesign of PEFs for projects, folders, files and classes

JT 2.6 separates the language independent PEFs for projects, folders and files from the PEFs representing language specific file contents. Now there are two containment hierarchies:

They are linked by the reference from compilationUnitT to fileS. As a mnemonic aid, the suffix S of projectS, sourcefolderS and fileS stands for “Source”. It indicates that these elements representat language independent Source information, not abstract syntax tree elements (which have the suffix T – for Tree).

As a followup change the second argument of classDefT now refers to a compilationUnitT instead as a packageT!

projectT became projectS

projectT('projectName', 'localPath', 'outputProjectName', 'outputProjectLocalPath')

projectS(#Id, 'projectName', 'localPath', 'outputProjectName', 'outputProjectLocalPath')

Note that that not only the PEF name changed, but also the structure. Each project now has its own identity.

projectLocationT became sourceFolderS

projectLocationT(#file, 'ProjectName', 'SourceFolder')(#file, 'ProjectName', 'SourceFolder')

sourceFolderS(#id, #ProjectID, 'SourceFolder')(#id, #ProjectID, 'SourceFolder')

Note that that not only the name changed, but also the structure. Each folder has its own identity and refers to its containing project via an identity. It does not refer to contained files anymore. The files refer to the containing folder via its identity (see below).

fileT was split into two PEFs

fileT(#id, #package, 'filename', [#def_1,…])

fileS(#id, #sourceFolder, 'path') and compilationUnitT(#id, #package, #fileS, [#import1, …], [#typeDecl1, …] )

Previously, fileT mixed language independent information (e.g. the file name) with language specific information (e.g. packages). It has therefore been split into an element that only represents language specific information (fileS) and an element that represents Java-specific information and links it to the file (compilationUnitT). See the documentation of compilationUnitT for hints how to migrate old code.

Redesign of PEFs for identifiers, class literals, and qualified type names

In JTransformer versions < 2.6.0

  • identT represented identifiers, class literals, and qualified type names.
  • identT and selectT jointly represented qualified type names in constructor calls (e.g. new Outer.Inner(..)).
  • newClassT referred in its sixth argument to identT or selectT elements

Since JTransformer 2.6.0

  • identT only represents identifiers.
  • selectT represents class literals (TypeName.class) or the access to “super” or “this” in inner and anonymous classes.
  • typeRefT represents qualified type names in static method calls and static field accesses
  • newClassT refers in its sixth argument to a classDefT element representing the class instantiated by this constructor call. This is an inlined representation of qualified type names in constructor calls (e.g. new Outer.Inner(..)).

newClassT

newClassT (#id, #parent, #encl, #constructor, [#arg_1,…], #typeExpr, #def, #enclosing)

newClassT(#id, #parent, #encl, #constructor, [#arg_1,…], #instantiatedClass, #def, #enclosing)

The sixth argument (#instantiatedClass) now refers to a classDefT element representing the class instantiated by this constructor call. Before JT 2.6.0, it referred to identT or selectT elements.

identT

identT(#id, #parent, #encl, 'name', #symbol)
only represents identifiers. In JTransformer versions < 2.6.0 it also represented class literals and qualified type names. Now

  • class literals are represented via selectT,
  • qualified type names in static method calls and static field accesses are represented via typeRefT,
  • qualified type names in constructor calls (e.g. new Outer.Inner(..)) are inlined into the sixth argument of newClassT.

selectT

selectT(#id, #parent, #encl, 'name', ENCLOSING_TYPE, #selectedType)
now only represents class literals (TypeName.class) or the access to super and this “instances” in inner and anonymous classes. Previously, it was also used for representating the nesting of qualified type names in constructor calls.

typeRefT

typeRefT(#id, #parent, #encl, #type)
A new AST element. Represents a (qualified) class name in static method calls or static field access.

New PEF for comments

The new PEF for comments represents arbitrary comments. For Java source files javadoc, block and end-of-line comments are represented. This PEF supports loss-free reverse engineering after transformations.

research/jtransformer/api/java/migration/upgradeinstructions.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2024