Subject: RE: APLib
From: Karl Lieberherr (lieber@ccs.neu.edu)
Date: Wed Dec 18 2002 - 09:23:57 EST
The course is over but you might still be curious why the
Object Form checker did not work on the AP Library.
Pengcheng Wu found the explanation of the puzzle ...
An interesting question seems: how can we make AspectJ programs
less brittle with respect to their intended invariant?
We wrote the LoD checker with the intent that it would not modify (only
observe) the
behavior Java programs; that is the invariant that we had in mind.
But we were wrong. Can we use model-checking or theorem-proving techniques
to show that an aspect does not satisfy its invariant: "only observe"?
-- Karl
>-----Original Message-----
>From: Pengcheng Wu [mailto:wupc@ccs.neu.edu]
>Sent: Tuesday, December 17, 2002 4:05 PM
>To: Karl Lieberherr; David H. Lorenz
>Cc: Kojarski Sergei; Paul Freeman
>Subject: APLib
>
>
>I now understand why checkers failed on APLib test case. There are two
>classes
>in the APLib, which are OrderPreservingHashMap.java
>OrderPreservingHashSet.java and both extend HashMap and HashSet
>respectively. When one of the methods in those two classes gets executed,
>it will activate the percflow aspect, in which the add method on
>the HashSet object that we use to record the arguments/return values/new
>objects will be executed. But when you add an
>OrderPreservingHashMap/HashSet object (this) into a HashSet, according to
>the implementation of HashSet, the hasCode method on that object will be
>executed, which in turn will call entrySet() method on that object, which
>has been overriden by OrderPreservingHashMap/HashSet. The execution of
>entrySet() will cause the percflow activated and the same procedure will
>happen again so that it produces an infinite loop until stack overflow.
>
>To walk around this problem (although it is very rare that HashMap/HashSet
>are extended), the only solution I have right now is not to treate 'this'
>as a hidden argument of a method, so that that add method will not be
>necessary and the loop will stop at the first place. Instead of treating
>'this' as a hidden argument, I know view the method on 'this' is OK by
>default and process this logic in Check aspect. That is, if this==target,
>then the method call is OK.
>
>--Pengcheng
>
This archive was generated by hypermail 2b28 : Wed Dec 18 2002 - 09:20:41 EST