FAMIX Java language plug-in 1.0

 

Author

Sander Tichelaar (tichel@iam.unibe.ch)

Version

1.0

Last modified

1999-09-07

  1. Abstract
  2. This document describes the language plug-in to the FAMIX 2.0 model [Deme99] for the Java programming language [Gosl96]. It handles interpretation issues concerning Java in FAMIX and the extension of the FAMIX model for Java specific features.

  3. Notation

The basic FAMIX model is modified in three different ways to handle Java sources:

  1. Modified classes
    1. Model (interpreted)

Model

SourceLanguage

SourceDialect

Figure 1: Model

The new or modified attributes are:

    1. Package (interpreted)

Package

 

Figure 2: Package

A Package maps in Java to the Java package construct. Packages in Java have the following properties:

Normally packages in Java map directly to the directory structure of source code, i.e. the source code for a certain class in a certain package appears in a directory with the same name as the package. Nested packages appear as subdirectories of the directory with the source code of the encapsulating package.

    1. Class (interpreted and extended)

Class

isInterface (): Boolean # new

isPublic (): Boolean # new

isFinal (): Boolean # new

isAbstract

belongsToPackage

Figure 3: Class

Both classes and interfaces in Java are mapped to the FAMIX entity Class. Interfaces differ from classes in that they can only define abstract methods and final static variables. Interfaces cannot inherit from classes (for a full discussion, see InheritanceDefinition, p.*).

The new or modified attributes are:

    1. BehaviouralEntity (interpreted)

BehaviouralEntity

declaredReturnType

declaredReturnClass

Figure 4: BehaviouralEntity

The following attributes are interpreted as follows:

    1. Method (interpreted and extended)

Method

isFinal (): Boolean # new

isSynchronized (): Boolean # new

isNative (): Boolean # new

accessControlQualifier

signature

isPureAccessor

hasClassScope

isAbstract

isConstructor

Figure 5: Method

Each definition of a method in source code constitutes this entity.

The new or modified attributes are:

    1. StructuralEntity (interpreted)

StructuralEntity

declaredType

declaredClass

Figure 7: StructuralEntity

The following attributes are interpreted as follows:

    1. Attribute (interpreted and extended)

Attribute

isFinal (): Boolean # new

isTransient (): Boolean # new

isVolatile (): Boolean # new

hasClassScope

accessControlQualifier

Figure 8: Attribute

The new or modified attributes are:

    1. ImplicitVariable (interpreted)
    2. ImplicitVariable

       

      Figure 9: ImplicitVariable

      Implicit variables in Java are this, super and class. this is an implicit instance variable which refers the current object a method is executing in. super refers to the superclass of the current object. class is not an implicit variable in the strict sense of the word (as it is also a keyword in Java). An expression like String.class evaluates to a reference to the String class object. This works for all types, including the primitive types. It is close enough, however, to an implicit static variable to be modelled as an implicit variable.
      Normally implicit variables will only appear in a transfer when they are explicitly referenced by other entities.

    3. LocalVariable (extended)

LocalVariable

isFinal (): Boolean # new

Figure 10: LocalVariable

The new or modified attributes are:

    1. FormalParameter (extended)

FormalParameter

isFinal (): Boolean # new

Figure 11: Attribute

The new or modified attributes are:

    1. InheritanceDefinition (interpreted)

InheritanceDefinition

accessControlQualifier

index

Figure 12: InheritanceDefinition

In Java classes always inherit from a single class (except the root class Object that doesnít inherit from any class). A class can implement multiple interfaces, which simulates some kind of multiple inheritance, but as interfaces do not have any implementation, resolving which method needs to be executed, is not a problem. Interfaces can inherit from multiple interfaces. In FAMIX classes and interfaces are treated similarly, as shown by the fact that they are both represented as classes, therefore both class inheritance and interface implementation is represented by an InheritanceDefinition in FAMIX.

The new or modified attributes are:

    1. Invocation (interpreted)

Invocation

base

candidatesAt

Figure 13: Invocation

The new or modified attributes are:

  1. New classes
    1. TypeCast

TypeCast

belongsToBehaviour (): Name

fromType (): Name

toType (): Name

Figure 1: TypeCast

This new association models type cast like (MyClass)variable.

Type casts are interesting for reengineering as they often point to problems in the design of a system. There will be an instance of this class for every type cast occuring in the source code, even if the cast is between the same types, because we are interested in all the places where casts occur.

The attributes of TypeCast are:

  1. Miscellaneous
  2. Java does not have functions or global variables, thus those entities will never appear in a FAMIX model of a Java system. Next to that, arrays and primitive types are not handled explicitly in this FAMIX extension either.

    Then there is a minor issue about file visibility. Normally a class with default visibility is visible within its package. However, when such a class is defined in the same file of another class and the name of the file is the same as the name of the other with the .java extension and theses classes are not defined in the default package, then the class is not visible outside the file, even to classes in the same package that are defined in other files. This issue is not dealed with in this Java language plug-in, because itís a minor issue and in model transfers we assume a compilable system anyway.

  3. Pending issues

Issues not yet covered in this plug-in are:

  1. References

[Deme99] FAMIX 2.0, technical report, University of Berne, 1999.

[Flan97] David Flanagan, Java in Nutshell: 2nd edition, O'Reilly, 1997.

[Gosl96] James Gosling, Bill Joy and Guy Steele, The Java Language Specification, Addison Wesley, 1996.

 

Cover Pages

Achievement 2.4.1b

FAMIX Java language plug-in 1.0

1) Identification

Project Id:

Esprit IV #21975 "FAMOOS"

Deliverable Id:

D 2.2 Ė FINALFHB Final FAMOOS Methodology Handbook

Date for delivery:

31.08.99

Planned date for delivery:

31.08.99

WP(s) contributing to:

1

Author(s):

Sander Tichelaar

2) Abstract

This document describes the language plug-in to the FAMIX 2.0 model [Deme99] for the Java programming language [Gosl96]. It handles interpretation issues concerning Java in FAMIX and the extension of the FAMIX model for Java specific features.

3) Keywords

Object-oriented, reengineering, reverse engineering, code repository, round-trip engineering, FAMOOS, FAMIX, Java.

4) Version History

Ver

Date

Editor(s)

Status & Notes

0.3

24.08.99

Sander Tichelaar

First draft version released for public review.

       

5) Issues for future releases

See Pending issues, page *.

6) Table of Contents

FAMIX Java language plug-in 1.0 *

1 Abstract *

2 Notation *

3 Modified classes *

3.1 Model (interpreted) *

3.2 Package (interpreted) *

3.3 Class (interpreted and extended) *

3.4 BehaviouralEntity (interpreted) *

3.5 Method (interpreted and extended) *

3.6 StructuralEntity (interpreted) *

3.7 Attribute (interpreted and extended) *

3.8 ImplicitVariable (interpreted) *

3.9 LocalVariable (extended) *

3.10 FormalParameter (extended) *

3.11 InheritanceDefinition (interpreted) *

3.12 Invocation (interpreted) *

4 New classes *

4.1 TypeCast *

5 Miscellaneous *

6 Pending issues *

7 References *

Cover Pages *

FAMIX Java language plug-in 1.0 *

1) Identification *

2) Abstract *

3) Keywords *

4) Version History *

5) Issues for future releases *

6) Table of Contents *

7) List of Figures *

8) List of Tables *

 

7) List of Figures

Figure 1: Model *

Figure 2: Package *

Figure 3: Class *

Figure 4: BehaviouralEntity *

Figure 5: Method *

Figure 7: StructuralEntity *

Figure 8: Attribute *

Figure 9: ImplicitVariable *

Figure 10: LocalVariable *

Figure 11: Attribute *

Figure 12: InheritanceDefinition *

Figure 13: Invocation *

Figure 1: TypeCast *

 

8) List of Tables