Information Technology Reference
In-Depth Information
The preprocessor's transformation from Java to non-nested Java as described
in [IgP02] has two steps, first a so called elaboration ε as mentioned above, and
then a compilation
.
In this paper we need not talk about elaboration of types since our Java-
programs π originate from distinguished Algol60-programs π . Inheritance is
trivial here, the only superclass is Object which needs not be mentioned explic-
itly. So, if an applied occurrence of a field or formal parameter f is declared
non-locally in an enclosing class named p e then
f is elaborated to p e .this. f .
If a method m in a method call m ( is declared in a class named p e then
m ( is elaborated to p e .this.m( .
If a class p in an instantiation new p ( is an inner class and is declared in its
enclosing class named p e then
new p ( is elaborated to p e . this . new p ( .
See [IgP02] for a more complete system of elaboration rules.
We illustrate the effect of elaboration in our Java-program example π 2 :The
three free places (indicated by
||
)infrontof g , new q( and new % q( are
to be filled by p.this. . Variables like p.this inside (inner) classes like q or
% q denote components of the display vector (resp. of the static chain) of q
or % q [Dij60, GHL67]. It is a crucial problem how the runtime system has to
determine the values of these components in a right way. See the indications
after Theorem 5.
For a description of the preprocessor's compilation
we restrict to Java-
program constructs which are resulting from Goerigk's transformation in sub-
section 2.4 and from Igarashi's and Pierce's elaboration ε above.
For illustration we show the transformed
||
π 2
|
|
of our Algol60-program ex-
ample π 2 :
{
public void call ( tau f , boolean g ) ;
interface tau
}
class p {
tau f ; boolean g ;
public p ( tau f , boolean g ) {
this.f = f ; this.g = g ;
f.call ( new % q (this),false); }}
class % p implements tau {
public void call ( tau f , boolean g ) {
newp(f,g); }}
class q {
tau r ; boolean s ;
p this $$ q;
public q ( tau r , boolean s , p this $$ q) {
this.r = r ; this.s = s ;
this.this $$ q = this $$ q
System.out.println ( this.this $$ q.g );
}}
Search WWH ::




Custom Search