Subject: Re: question about hw2
From: Paul Freeman (pfreeman@ccs.neu.edu)
Date: Mon Oct 07 2002 - 08:33:38 EDT
Hi Wei -
You are correct that the call to b1.bar() is a violation of the LoD.
And this should be caught by the application, BUT it is a know bug in
the implementation that we are not looking to correct. You should
assume that the instance variables are "write once". Replacing them, as
you did below, will not replace them in the hashmap that stores instance
variables in our implementation. Fixing this would require more than
one line of code.
You should look for a different problem with the implementation
regarding instance variables. There is at least one call in the Foo
class from part one that is not caught, but should be. A good place to
start might be to try to isolate the calls in this class, trying to
figure out which ones aren't causing "!! LoD Violation !!" statements to
be printed when they should be.
Paul
Wei Hua Chen wrote:
>Paul, thanks for your answer. It answered my previous question but I'm
>still confused:
>
>Class A{
>B b;
>void foo() {
>B b1 = C.getB();
>b = b1;
>B b2 = D.getB();
>b = b2;
>b1.bar();
>}
>}
>
>The call b1.bar() is not a call to an instance variable but is not caught
>here as a violation. But I guess that is not something we are looking for
>here?
>
>So I should be looking for a call on an instant variable that is not a
>violation but the program think it is? (As you mentioned that is the only
>thing this program supposed to do.)
>
>Thanks.
>
>:Wei.
>
>On Sun, 6 Oct 2002, Paul Freeman wrote:
>
>>Hi Wei -
>>
>>The intention of the program is to catch violations involving calls to
>>methods of 'instance variables' of a class. It is not intended to, for
>>example, catch violations involving calls to methods of 'arguments' to
>>methods of a class. Finding the missing line won't add this
>>functionality. Finding the missing line should make it correctly catch
>>violations involving instance variables (it doesn't in it's present state).
>>
>>My suggestion for trying to figure out what is wrong (it isn't obvious)
>>is to try find a test situation that should be caught, but isn't. Once
>>you figure out why it isn't being caught, and read in the AspectJ
>>documentation about Singleton Aspects, you should be able to put it
>>together and figure it out. "Singleton Aspect" is a clue to the
>>answer... it isn't necessarily the solution.
>>
>>Hope this helps,
>>Paul
>>
>>
>>Wei Hua Chen wrote:
>>
>>>Hi, I have a question about part 2 of hw2. In the comments, it says this
>>>program "only allows calls to immediate part objects(data member of
>>>this)", so is the intention of the program to catch calls to member
>>>methods of the class(static and non-static) as violation? (or that is
>>>what's missing in the code?)
>>>
>>>I remember the professor mentioned something about "singleton aspect" as
>>>hint to this problem, can you elaborate it a bit?
>>>
>>>Thanks!
>>>
>>>:Wei.
>>>
>>>
>>>
>>
>
>
This archive was generated by hypermail 2b28 : Mon Oct 07 2002 - 08:35:58 EDT