Opened 19 years ago

Closed 15 years ago

#63 closed defect (fixed)

Wrong transformation for inner classes

Reported by: Bernhard Haumacher (haui at haumacher dot de) Owned by:
Priority: normal Milestone: 1.04d
Component: JP trafo Version:
Severity: normal Keywords:

Description (last modified by hauma)

Access to variables of the enclosing class from inner classes is not possible and gives an error in transformed code.


Write full qualified access patterns for the variable like in the following example:

class A {
   int x;
   class B {
      void foo() {
         A.this.x = 13;


There are two options to fix this issue:

  • The computation of access patterns during the JavaParty transformation must be adapted to inner classes.
  • The order of the transformation steps form remote classes and inner classes must be changed.

Since the inner class trafo is no source to source transformation, it cannot be done before the JP trafo, because the JP trafo expects source code and generates source code.


The computation of the full qualified name for all variable accesses was changet in order to account for inner classes.


All variables are now accessed with fully qualified names (after the remote class transformation). But final variables can not be initialized with a fully qualified name.

Variables of remote classes are problematic, because the the remote class changes its name during the transformation. But remote classes are not supported at all, so this fix should work in most cases.



See also


Attachments (0)

Change History (2)

comment:1 Changed 15 years ago by hauma

  • Description modified (diff)
  • Resolution fixed deleted
  • Status changed from closed to reopened

The fix in [888] for accesses to final variables is broken, because it does not consider to witch class the variable belongs. The variable x in the following example was referenced through this.x in B:

class A {
   final int x = 10;
   class B {
      int y = x;

comment:2 Changed 15 years ago by hauma

  • Resolution set to fixed
  • Status changed from reopened to closed


Generate accesses as relative as possible. Only accesses to variables of enclosing classes must be fully qualified. Accesses to instance variables of the same class can be relative to this. See: [2822].

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.