HAL Id: hal-00627861
https://hal.science/hal-00627861
Submitted on 29 Sep 2011
HAL is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.
Java Multi-Method Framework
Rémi Forax, Étienne Duris, Gilles Roussel
To cite this version:
Rémi Forax, Étienne Duris, Gilles Roussel. Java Multi-Method Framework. 2000. �hal-00627861�
ValueImpl PlusImpl
String toString(Value v) String toString(Plus p) String call(Expr e)
ToStringAlgo int getValue()
Value
Expr getLeft() Expr getRight()
Plus Expr
implements
(provided) specifications
Interface
(user defined)
(provided) classes Implementation
specification algorithm
Apart
extends
Figure 1. Algorithm user-specified apart from provided interfaces and classes
Serializable Cloneable
Object
J I
K C
E D
[D
[B B
[Object
double
float
long
int
char short
byte primitive
Interface Class
T’
T
is a supertype of
Figure 2. Classes, interfaces and primitive types hierarchies
is a supertype of
B D
Object
m2 m3 m1 1 2 3 T
J
The fact that T could be the type of - the 2nd parameter of m3 or - the 3rd parameter of m1 is depicted by:
D
B C
E K I
Figure 3. An example of annotated DAG
K C B
I I D
K
E E C B
D E
I I
E D D
m3 : (D,E,E)
and
With m1 : (B,C,K) m2 : (D,I,I)
and are not comparable
m1 m2
more precise than m1
is
m3 m3
more precise than m2
is
Figure 4. Using partial orders to resolve ambiguities
T’
T
¡
1 2 3 T
E E E
K I K K C
C I C
there is a conflict case ( ) onEin first position.
¡ ¡ ¡ Object
¡I I I
¡I K K
¡ ¡ ¡ J
¡E E E
¡C I C
D¡¡ D
B¡ ¡ B
conflict (propagated) weak strong (set)
"no type" (init.) at each parameter position:
Behavioral annotations of T With two additional methods:
m4 : (K, C, K) m5 : (C, C, K)
(a) (b)
Figure 5. Behavioral annotations of the DAG
The newly added type behaves as a
and as a in third position.
in second position
I K
F
D¡ ¡ D
¡I K K
¡C I C
¡E E E
¡I K F
¡I I I
¡ ¡ ¡ Object
B¡ ¡ B
¡ ¡ ¡ J
Figure 6. Dynamically supplement behavioral DAG