You are on page 1of 7

Aspect-Oriented Programming with Model Checking

Naoyasu Ubayashi Tetsuo Tamai


Systems Integration Technology Center, Interfaculty Initiative in Information Studies,
Toshiba Corporation Graduate School, University of Tokyo
Tokyo, Japan Tokyo, Japan
naoyasu.ubayashi@toshiba.co.jp tamai@graco.c.u-tokyo.ac.jp

ABSTRACT
  
   
 
     

    

    
 

   


    
 
    
  

   
          


 

   
     
 
     6
  
  


       
          
 $

   
      
      

    
          
    
         
 
 

      
 

    
           

     
!    

 
   
 
      
!   7  8
  
      

 

      
        $     
  

     
 
"
    
 
      
    
 

  #
 
"           
 
"
   
 
 
  $ 
     # %  #
 
"        
  

  
     & '  
    $ 
     # .  #

       
  #
 (  
   
         
  
    #
  # "
 

9, 
 


  :    #
  
 
Categories and Subject Descriptors 
"
         .  #

)( *+& ,  -


     

 

   #
   
   
  
General Terms % 
  
     & '  
 

    
        
  #

(   
    #
  # :
Keywords 
 "  
   #

 
 
.  #
 /

  0#
  # 
 
        
   
" 4
  
"
  6
1. INTRODUCTION
  #


 
  "    


    
*'1+*'2+
       
  %     
 




 
    
  


    .       

  

 

   
            
     $







       
    
    % #
      
       
    
 


      

  #

 
   
 
    : 
  
   
  
   3 
  
  4         

    
"   

  
     
  #
     

  /
"


     


       


     
      
 
 


          4 

   

     
    


Æ          


      
"
 

    

  
   

  



    
 
           


 ( 
 ;    
 
Permission to make digital or hard copies of all or part of this work for #


         
personal or classroom use is granted without fee provided that copies are 
 <  $ 
  #
 


not made or distributed for profit or commercial advantage and that copies      
   ,
 =  
bear this notice and the full citation on the first page. To copy otherwise,    #
  # ,
 1
 

 
to republish, to post on servers or to redistribute to lists, requires prior
specific permission and/or a fee. AOSD 2002, Enschede, The Netherlands
9

 >     
  
Copyright 2002 ACM 1-58113-469-X/02/0004... 5.00 5
2. AOP AND RELATED ISSUES  ' (" 
2.1 AOP  "  ) # "
   
  
  4  

% 
  *+ ,
    
  
        - -  ..  -

     
 
  *(+ 



    #
   
    +  $% ,  *+ 

   
  6


    /   01'
  
     ,
    

*''+ 0

 ?
 *'+ : . *'=+*('+*((+ + 0# ( ,  *+ 
  
   
*@+      

 #

  
   
  *A+ %     
        B*(+  
 
$ 
  B    
B
  
 "   
  
  B   
3      
4
 &


 "  
   -$
 
  


  $
  
  
"  


 .
    
B              $

  

                     D
       $
   
"             $

  

   $
     
   C C       D
   
" 


2.2 Issues on AOP % "    
   7     
 
 
        "   
   #    


    
  



    
  

      "

   
 

 
"


   
    
  3 

    # $   

      
 
  


     

 < 


Æ
           


 
           
  


        
 % 
     
   3. VERIFICATION WITH MODEL


 CHECKING
Example: error logging 3.1 Model checking
          
   
 
 
   
"
   
  #

 
  
     4
  
    .  #

      #
  
    

              
"      *1+
      
 
              

    !
  
4   $    
 
   
          #
      .
 
  
   *(+  

      
"    
   .
     


         % 
 
 $     E  6 .
 "  


    $  
   
   "
    
 $     

    " 
 #  
  
 
   %  
  
 4     

   
 
       
   
  0%9F0
 % 
    
       
   9
 
 
   
  
  
 
                       
   
   

        $



    




 
       

#         

     

   
 
"
  *1+ ?

 
 
   
#   

     '  0%9F  
    

  
 
           4 
"       
 
 
" 
  4 
" &   
  -
   
 


     & G $ 
 ?
  

H  6 
 : 
         
     
        0%9  9%99
 %  9
    

  !   0%9F 0%9
    

 
  9%9
  
 

  "   #$%    
 
 0%9      4 
  

    


   
  9%9  

&       


  

    



 *1+
s
  
 
% 9  
  

"

, I :.-9 9%9  

M,s |= AG( )

B ?
 B  

7   B 9%9
-,0CB B  

ThrowingException-Bar-m1
--> AF ErrorLoggin-Bar-m1

ThrowingException
-Bar-m1

put
Producer Consumer
halt get
ErrorLogging
-Bar-m1
0 1 2
HaltException

ErrorLogging ErrorLogging
-Bar-m1 -Bar-m1
Buffer


   
    

     

Example: error logging 3.3 AOP verification with model checking


9 "        



  %
        
     
    
  #
 .  #


 
  
 
      
23 4) &560#(        
"   
 
" 
7 & ("      
    
 4
  

"
        
$ 

  
     6
  #
  
%
 0%9F     
  &    
       
"  7  8

  
      
"      4
  
"
   
   
 
 $

     -  9
7 '  




    .    

  $

  
        
        
  
% 
-$
 7 ' ?
  '
       $




   
  

  0%9F    
 $ 
      $     

  
4. APPLICATION TO AOP

 
    #

 
   $
3.2 Main model checkers       % $
       
, I*';+  ,./*'>+       #  B         C0    
 
?
 B*'(+ 7  *<+*>+  -,0CB*(2+   

  
       $   


   #
  
  B      
   

, I    
   
    

   :.-9  #   9%9 4.1 Example
  , I
         #   
?
  (  $
    


 
    


Æ  
         
  8      

:.-9    $
 
"  , I     8  % 8
  
 %
.    #    B  7      B     

  8
    

        
   
 
       
  
  8
   %  
6
           

 
  8
    
   
  
"    #
 .   


  
  8
   %     
   
"
     

    ! 
   
  8  % $
 
     
"  9%9  
 
 # $ 

  
       
    
   
         8
    !
  7
   
 
   %  
 

                

   
         4 
     



 $
     
  9%9     
        4     9%9  
$  
  $ 
B½   

   
     
 
  
"
?
  ;     
   
  
  


Æ  
    
      
     
  
%        

#

 % ' 
  "   ½

$ 
 
       

*'(+ 
#
 B
TraceAspect ; %        
  

 2
Aspect for  " 
  

 '   
$ 
ConcurrentAspect
method

  

 ( %       
! 
tracing
Aspect for
concurrent
processing
< M          $

 # $ 

     

  
%       

  
Basic function    
  
"
     
Buffer Class

 


    

   !" %    
   
      
 EE 2


Æ  
       $ 


     
     
 
    #

   
   
 

Classes Aspects

Buffer Class ConcurrentAspect


       $
  
   
       


: TraceAspect

           !   


 
  
"
 0     
 
  
AspectJ
Æ    #
      
woven
 
 

Java code
5. AOP-BASED MODEL CHECKING FRAME-
WORK
Model Checking 
 
      #
  #

 
      #
 Æ
  6

 # $ 
  

 #
  #   
   # 
      
     
          %    #
     
         %
  #       
   #

       


  
    

  
  
 

  %J        
   
0 
     8    
 5.1 Basic concepts

$  B   
    

   & 
$   
     #
   
 
 1< K 1@ B  
     #

    6

     
  
 
   '*'(+ ) #        #
  
     
     
          
           
     
   #   
 
4.2 Checking crosscutting concerns               


        
      
$ 7 %  '


$ 7
 
        
   
$  
  
 1< K 1@     

$
     

       %
     
   &
  
  
"
      $

 
" 
  #
 ?   

  : 



   #
  

   
  
       

         

  
 
    


       


  
 J

      0#
  
       

      4        
  

     J
 $L    

  
     
       
 
   
     
 
 ;(   #
       
    
    
  %¾ 

        
  #
 
$      # ?
  <
    "   
 #



 7  
 
      
' %       
  8
   
  
  



  2 ' (  
         

( %     "     
" 
                 

     
"
  
  
        $       
%          
     #
¾
%
   $
   *'(+
      
 #
  

Program to be checked Checking aspect X
  %
 
  !"&  
 before

I 0#
 C B

  

mothod
pre-condition

  


'   

 ,
    After



 

 ,
   post-condition

(   

 ,
   
  

 

 ,
   Checking aspect Y
;  
  


7 -$   It is only needed to weave aspects

 


7 -$  that describe checking features
corresponding to testing viewpoints. Checking aspect Y

 

       
 
 
 ' !"& 
 
 
   #
  
 M 
   

   #    


Æ    
     
8   #
   
    /  
  
"  #
 $

    6

+  % 

   
    #
     +' ,
   

     #
        .. 
                + , +'

+   


    
 #   #
     
   + , +'

+   


5.2 Join points needed for checking 

B*;+    (       

  -
8*'A+ 
  $

  

  
      
     $

  #

     
  #



            #    M       B     
            

     #
   "  

 
 
 

 

     
  

        
 

  #
 3 


Æ
     
 
     #
  # 


  
    

       
    # 6    
 #




 
   
       #     
  ? $

   %   
   8

   #       # 
 
 
   $
  
        B     #   
  

       

   
    
"        

 
   
" 

  
 
   

    
   


  #


  #
  # 
        
 #


    


      

   
      
  
   
 

      
" 

      %  $    
        
(  

   #
  #  
 #
   
 #



B       %        


 
            

    
    

  #
 %   #      
"  
  

  
 


  %
 


 $  

B 6
    #
    

%  
  

  
  " 
   
  #
 
    

 %
 

 $  

B      %
   #   
  GG 
        

  9  
   
*=+ G 
 
   $ 


  

  
   


 
 
  #   B6
    " 
%
 

 $  

B     B   
      
 
"  %
      
" 

     
   #
  #      

       #
     
 
  #    
  #
    
 
 

      #
  
  


  6. DISCUSSION
   
          #

 
 
      

    3 
5.3 Checking framework            Æ
     
%    #
  #
   
    #
 7   #  

 #
  #
  
 $   B  7              
    
    

  
$
     
   ? 
  


  
?
  = % 

  $ 7   $   "
         #
  #

B
  
"   9%9     B  
  
   

 /
     *'2+ -   % ?
  :-  7  &
$   
  # 
   
    
      /
" << '2 (@;( (22'
   
"
    

 
 *''+ 3
  M    3& ,
 
     
 
        
  ) **+,01 <''<(A '@@;

   
 

      
*'(+ 3  O& B ?
 6 H
 '@@@
    ) 
  
 M
   *';+ 3  HB  ,
 .3& % .  0#
     
     B
   , I   ) + (; = (>@(@= '@@>

    )        )
   *'<+ B#  )& &     
   
        
          + ... (222
B   7 

      *'=+ O  -& : .  )
 
       
   
  
  
 
    

 
 

    

   ) **+,00 ;=;;1@ '@@@
 #   
    
 
*'1+ O
 H 9
 B . #  .  0
 )   
        # 9 0 9

  B  
 B& 
 


) 
   
         
  ) **,02 9  I

  
"
     
     0 ,
  ,
  '(<' ((2(<(
 
  
  
*'@+ *'@+ *'<+ '@@>
 9 %  

 , 9%,       *'>+ ..
  O9& ,
 .  0#
& 
        N
 
  #
    , -$
   O
 
 
 
     9%,
  
 '@@;

  #

        *'A+ .  7& 
  ,  0  
 
( -

    
 3 (222
%    

  
   # *'@+ I  % 0  )     & , 

    
   3  ?  /
"
  0 
0    )
         8    34*5 .. 9  I
0
   #        ,
  ,
  ('@( '=;'1@ (22'
      

  
      *(2+ O : . 9
 H  I   B 7 ,$&
 



    #


   -,0CB 6 L .  (222
            *('+ %
 %&   &  
  
    %

         
 

 
      +   / 
  ? $        #
/<' I'< '22='2'2 '@@@

 
     
     *((+ 6
 I  %
 %& , 
  0  
             
  
.
    

   ) 34*5
.. 9  I
0 ,
  ,
 

   ('@( A@'2@ (22'
7. CONCLUSIONS APPENDIX

   '    
     A. Producer/Consumer problem [AOP]

  #
 (    #

  #               Buffer Class
  
    
     ,   ++ 
!,  +  /*8( ) 9
8
     
  "   9, $%:;  ) # $%:/*8(;
<,  ' ) =
8. REFERENCES >,  ' ) =
?,
*'+ #
 .  %

 & )  
 @,   0A  $% 
.

,
C,%  ) **+,-- B, :'; ) 
(1=(>= '@AA C, ' ) ' D  E /*8(
*(+ B &CC C =,
,

*;+ % B   
H
 (22' !,   0A $% 
*<+ 7   9, 0# F ( 
&CC
# C  C  C <, $%  ) :';
*=+ 7# O& -$    
-$
 & -  >, :'; ) 
0  
 M '@@@ ?,
@,
' ) ' D  E /*8(
 
*1+ 0 # - H       )& .  B, 
0#
 % . %   '@@@ C, 
*>+ 0  B0 )  .7 3
8 B 9 ,
   0,  N  3& 7  & -$ 

?

 .    B ,  0   ) Concurrent Aspect
+ ... (222 ,  &
!, + 0%++ 
*A+ 0 #
 O  -
 #  6M& H  
 9,
  
 
 M (222 <,
>,
 /  ) =
  0  ) + 
*@+ )   ?,
&CC  C  C  C @,

+ GGHH 0


B,  ++'++ , @,
C,    -   ..  B,   &L  & 
=, C,    
, +++ , ++' !=,   &L 3  
!, #0  /  )) ++ /*8( !, 
9,  !!, 0  ) 
<,  # !9, 
>, 0*(  !<, 
?,  !>,
@, !?,

60 '  


B, +++ , ++' !@,   '  60 
C, + /  )) =  +&  !B,  +  $JM6 ) ?
!=, / DD !C,  ++ ++
!,  9=,
!!, 9,   '++  
!9,

+ GGHH 0 9!, ++ )  0 


!<,  ++5++ , 99, 
!>,    -   ..  9<,
9>,     
!?, 9?, +   ) =  I) $JM6 DD 
!@, +++ , ++5
!B, #0  /  )) = .. I0  9@, &L  ) # &L3-
!C,  9B, ++ 
9=,  # 9C,  
9, 0*(  <=, 
9!, <, ++ 0 
99, + 0 
--- J5II ---
<!, 
9<, F ( 0 ) # F ( <9, 
9>,  0#0 <<,
9?,  <>,

60   


9@,  <?,     60 
9B, <@,  ++ ++
9C, +++ , ++5 <B,
<=, + /  )) ++ /*8(  +&  <C,   ++  
<, /  >=, ++ ) 
<!,  >, 0 
<9, >!, 
<<

 GG0 HH 0 * >9,


<>,   0A  ++ 0   ><,     
<?, >>,   ) =
<@,  ++F ++ , >?, &L:;  ) # &L:=;
<B,    - 0   ..  >@, 
<C, >B, #0   I) =
>=, +++ , ++F  >C, :; ) &L++ 
>, 0  )  ?=, DD
>!,  +&  ?, 
>9,  ?!, 0F ( 
><,  ?9,
?<,

N+     + 1+


?>, N+ K I) $JM6K3
Trace Aspect ??,   )) ' $JM6
?@, +   ) =  I)   DD
,  6&  ?B, N+ K#   K3
!,   *+, ?C,  :;  )) 
9,    - -  @=, 
<, @, 
>, +,  *+ @!, 
?, /   
@, K:6   0; K
B, D 01' "/ B. Aspect for model checking
C, 
=,  Verify Aspect
,  N+& 
!,  O  ,
Main Class, etc. 9,      .. 
,

60 2   <,


!,   2  >, +  , O
?,
9,     /:;   @,

N+     + 1+


<, ++  ) # ++ B, N+ K I) $JM6K3
>, '  ) # ' C,   )) ' $JM6
?,   ) #  =, +   ) =  I)   DD
@,  , N+ K#   K3
B,  !,  :;  )) 
C,
=,

60 &   9, 


,   &  <, 
!,     >, 
9,   &  
<, 0  ) 
>, 
?, 

You might also like