[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] "Re: HaltException Error in AOP Model Checking Consumer Producer Program"

Hi !! All,
 
Please resolve HaltException error in AOP Model Checking Consumer Producer Program.
 
class Buffer   {
   static final int SIZE =  3;
   Object[] array =  new Object[SIZE];
   int putPtr = 0;
   int getPtr = 0;
  public synchronized void put (Object x) {
   array[putPtr] = x;
   putPtr = (putPtr + 1) % SIZE;
 }
 public synchronized Object get()
                               throws HaltException  {
// can't resolve HaltException
        Object x  =  array[getPtr];
        array[getPtr] = null;
        getPtr = (getPtr + 1)  %  SIZE;
         return x;
 }                                   
}
 

// ---- The Main class
class Main {
   public static void main(String[] args)  {
       Buffer b = new Buffer();
       Producer p = new Producer(b);
       Consumer c = new Consumer(b);
   }
}
// -----The Attribute class
  class Attribute {
       public int attr;
       public Attribute(int attr)  {
            this.attr = attr;
    }
}

class AttrData extents Attribute {
    public int data;
    public AttrData(int attr, int data)  {
        super(attr);
        this.data = ""> }
}
// ---The Producer class
class Producer extends Thread {
static final int COUNT = 6;
private Buffer buffer;

public Producer(Buffer b)  {
buffer = b;
this.start();
}

 public void run() {
   for (int i = 0; i != COUNT; i++)   {
      AttrData ad = new AttrData(i, i*i);
      buffer.put(ad);
      yield();
  }
  buffer.halt();
 }
}

//---The Consumer class
class Consumer extends Thread {
    private Buffer buffer;

    public Consumer(Buffer b)  {
        buffer = b;
        this.start();
   }

  public void run()  {
     int count = 0;
AttrData[] received = new AttrData[10];
try{
      while (count != 10) {
         received[count] = (AttrData)buffer.get();
         count++;
      }
 }catch(HaltException e){};
// Verify.assert is an assertion for Jpf.
   Verify.assert("count != COUNT",
                          c.count == Producer.COUNT);
   for (int i = 0; i  != c.count; i++) {
   Verify.assert("wrong value received",
                              c.received[i].attr  ==  i);
     }
  }
}


 
On 5/13/08, aspectj-users-request@xxxxxxxxxxx <aspectj-users-request@xxxxxxxxxxx> wrote:
Send aspectj-users mailing list submissions to
       aspectj-users@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
       https://dev.eclipse.org/mailman/listinfo/aspectj-users
or, via email, send a message with subject or body 'help' to
       aspectj-users-request@xxxxxxxxxxx

You can reach the person managing the list at
       aspectj-users-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of aspectj-users digest..."


Today's Topics:

  1. Re: Generic aspects (Andy Clement)
  2. Re: Combining call and execution pointcuts (Marko Asplund)
  3. Using an after on a function called within an aspect
     (kmerriman+aspects@xxxxxxxxx)
  4. Re: Combining call and execution pointcuts (Andy Clement)
  5. Re: Using an after on a function called within an aspect
     (Eric Bodden)
  6. AspectJ5 and hot code replacement (Thiago Souza)
  7. Re: AspectJ5 and hot code replacement (Andy Clement)


----------------------------------------------------------------------

Message: 1
Date: Mon, 12 May 2008 09:00:38 -0700
From: "Andy Clement" <andrew.clement@xxxxxxxxx>
Subject: Re: [aspectj-users] Generic aspects
To: aspectj-users@xxxxxxxxxxx
Message-ID:
       <689d61aa0805120900m41fc33c4w53e05bb7782eac69@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1

The logs date is 20080511215715 and the build date is 20080510020449
so on this occasion the
build machine has gone bad - uploading the changes list but not the
build with the fix in.
Wait for a build dated after the bug was closed, should be later today.

Andy.

2008/5/11 Mark Stobbe <markstobbe@xxxxxxxxx>:
> Thank you for the quick fix, however, seeing from the logs the current build
> *should* have the fix included, but as I try to compile the code with the
> new libraries, it does not work.
>
>  Maybe somebody broke just after you fixed it?
>
>  Mark
>
>  --------------------------------------------------
>  From: "Andy Clement" <andrew.clement@xxxxxxxxx>
>  Sent: Monday, May 12, 2008 4:06 AM
>
>
>  To: <aspectj-users@xxxxxxxxxxx>
>  Subject: Re: [aspectj-users] Generic aspects
>
>
> > Fixed just now as https://bugs.eclipse.org/bugs/show_bug.cgi?id=231478
> > . Fix will be in next dev build of AspectJ.
> >
> > You may find other issues as you head into this area, do feel free to
> > raise bugzilla entries for anything you encounter.
> >
> > cheers,
> > Andy.
> >
> > 2008/5/11 Mark Stobbe <markstobbe@xxxxxxxxx>:
> >
> > > Ok, thank you for your fast reply. I hope it can be fixed soon, as it
> would
> > > be useful for me.. then again.. you are probably already busy enough :)
> > >
> > >  Just for the sake of completeness, here is a (not so much) working test
> > > case:
> > >
> > >
> > >  /* Error message: Type B does not meet the specification for type
> parameter
> > > 1 (A extends Base) in generic type GenericAspectA */
> > >  abstract aspect GenericAspectA<A extends Base> {}
> > >  abstract aspect GenericAspectB<B extends SubBase> extends
> GenericAspectA<B>
> > > {}
> > >
> > >  /* Base extends SubBase extends SubSubBase */
> > >  class Base {}
> > >  class SubBase extends Base {}
> > >  class SubSubBase extends SubBase {}
> > >
> > >  /* Plain Java implementation */
> > >  class GenericA<A extends Base> {}
> > >  class GenericB<B extends SubBase> extends GenericA<B> {}
> > >
> > >
> > >  Good luck!
> > >  Mark
> > >
> > >
> > >
> > >  --------------------------------------------------
> > >  From: "Andy Clement" <andrew.clement@xxxxxxxxx>
> > >  Sent: Sunday, May 11, 2008 8:55 PM
> > >  To: <aspectj-users@xxxxxxxxxxx>
> > >  Subject: Re: [aspectj-users] Generic aspects
> > >
> > >
> > >
> > >
> > > > Hi Mark,
> > > >
> > > > The docs only say (
> > > >
> > >
> http://www.eclipse.org/aspectj/doc/released/adk15notebook/generics-inAspectJ5.html
> > > > ):
> > > >
> > > >
> > > > > AspectJ 5 allows an abstract aspect to be declared as a generic
> type.
> > > Any concrete aspect extending a generic abstract aspect must extend a
> > > parameterized version of the abstract aspect.
> > > > >
> > > >
> > > > That page of the doc also shows some examples of a hierarchy of
> > > > abstract generic aspects, although none of them alter the bounds in
> > > > the way your example does.  So the fact that your code won't compile
> > > > is a bug that needs fixing.
> > > >
> > > > cheers,
> > > > Andy.
> > > >
> > > > 2008/5/11 Mark Stobbe <markstobbe@xxxxxxxxx>:
> > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Hello,
> > > > >
> > > > > First of all, I know this is not possible, as it says on the manual
> > > page..
> > > > > but I was wondering why..
> > > > > In plain Java you can redefine the upperbound of a type parameter, >
> > i.e.:
> > > > >
> > > > > class AbstractComponent<C extends Component> {}
> > > > > class AbstractWindow<W extends Window> extends AbstractComponent<W>
> > > {}
> > > > >
> > > > > Now.. trying the same thing with aspects.. does not work:
> > > > >
> > > > > abstract aspect AbstractComponentA<C extends Component> {}
> > > > > abstract aspect AbstractWindowA<W extends Window> extends
> > > > > AbstractComponentA<W> {}
> > > > >
> > > > > So.. my question, why isn't this supported? And what would be the >
> > "best"
> > > > > workaround?
> > > > >
> > > > > Thanks in advance,
> > > > > Mark
> > > > > _______________________________________________
> > > > >  aspectj-users mailing list
> > > > >  aspectj-users@xxxxxxxxxxx
> > > > >  https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > > > >
> > > > >
> > > > >
> > > > _______________________________________________
> > > > aspectj-users mailing list
> > > > aspectj-users@xxxxxxxxxxx
> > > > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > > >
> > >
> > >  _______________________________________________
> > >  aspectj-users mailing list
> > >  aspectj-users@xxxxxxxxxxx
> > >  https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > >
> > >
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
>
>  _______________________________________________
>  aspectj-users mailing list
>  aspectj-users@xxxxxxxxxxx
>  https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


------------------------------

Message: 2
Date: Mon, 12 May 2008 20:58:06 +0300
From: Marko Asplund <marko.asplund@xxxxxxxxxx>
Subject: Re: [aspectj-users] Combining call and execution pointcuts
To: <aspectj-users@xxxxxxxxxxx>
Message-ID: <1210615086.6807.9.camel@ubuntu>
Content-Type: text/plain; charset="UTF-8"

ïï
Gopinathan Balaji wrote:
ï> Try:
>
> aspect a {
>  pointcut a2CalledFromA1():
>    cflow(execution(void A.a1())) && call(void A.a2());
>}

Thanks for the reply, Balaji.

Sorry, for not being complete enough with my sample code.
I'd like the pointcut to only pick out direct calls to a2() from a1(),
excluding any calls to a2() further down in a1()'s control flow.
The class actually looks more like this:

ïclass A {
void a1() {
   a2(); // this should be picked out
   someMethodThatCallsA2FurtherDownTheCallChain(); // should exclude
calls to a2 from this and other control flows below a1
}

void a2() {
}

}


marko



------------------------------

Message: 3
Date: Mon, 12 May 2008 11:02:08 -0700
From: kmerriman+aspects@xxxxxxxxx
Subject: [aspectj-users] Using an after on a function called within an
       aspect
To: aspectj-users@xxxxxxxxxxx
Message-ID:
       <c18f74850805121102q480234d4vbaca8a8321e9ff0f@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1

I seem to be having difficulty with this attempt to use after advice.
Basically, in one aspect, I am declaring a function on a
class....Actually, code might help this.

class HappyClass {
}

aspect HappyAspect {
Foo HappyClass.foo = null;

public void HappyClass.doFoo() {
  foo = new Foo();
}
}

aspect OtherAspect {
after(Foo f) : call(Foo.new()) && target(f) && within(HappyClass) {
  // Do something cool here
}
after(Foo f) : call(Foo.new()) && target(f) &&
withincode(HappyClass.doFoo()) {
  // Do something cool here
}
after(Foo f) : call(Foo.new()) && target(f) && within(HappyAspect) {
  // Do something cool here
}
after(Foo f) : call(Foo.new()) && target(f) {
  // Do something cool here
}
}

Note that this does not apply, it says the advice did not match.  None
of the above advice applies.  Is there some trick I need to use to
aspect on function calls within injected methods?  Is this even
possible?  How would I do it if it is possible?

Thanks in advance,
Kendall


------------------------------

Message: 4
Date: Mon, 12 May 2008 11:05:03 -0700
From: "Andy Clement" <andrew.clement@xxxxxxxxx>
Subject: Re: [aspectj-users] Combining call and execution pointcuts
To: aspectj-users@xxxxxxxxxxx
Message-ID:
       <689d61aa0805121105v10f337anf460f00800979c4@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8

ïaspect a {
  pointcut a2CalledFromA1():
   call(void A.a2()) && withincode(void A.a1());
}

Andy.

2008/5/12 Marko Asplund <marko.asplund@xxxxxxxxxx>:
> Hi,
>
>  How can I pick out direct calls to a certain method from a particular
>  method?
>  For example how can I define a pointcut that picks out calls to a2()
>  from a1() in class A below?
>
>  I've tried the following pointcut definition but it doesn't seem to work
>  as expected:
>
>  ïaspect a {
>   pointcut a2CalledFromA1():
>     execution(void A.a1()) && call(void A.a2());
>  }
>
>
>  class A {
>   void a1() {
>     a2();
>   }
>
>   void a2() {
>   }
>
>  }
>
>
>
>  _______________________________________________
>  aspectj-users mailing list
>  aspectj-users@xxxxxxxxxxx
>  https://dev.eclipse.org/mailman/listinfo/aspectj-users
>

------------------------------

Message: 5
Date: Mon, 12 May 2008 16:16:22 -0400
From: "Eric Bodden" <eric.bodden@xxxxxxxxxxxxxx>
Subject: Re: [aspectj-users] Using an after on a function called
       within an       aspect
To: aspectj-users@xxxxxxxxxxx
Message-ID:
       <804e3c660805121316s4f9508cbw423958762e8a035e@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1

I think you problem is just the "call(Foo.new()) && target(f)". There
is no target on constructor call joinpoints. You can capture the
constructed object with after-returning.

This might help:
http://pointcutdoctor.sourceforge.net/

Eric

2008/5/12  <kmerriman+aspects@xxxxxxxxx>:
> I seem to be having difficulty with this attempt to use after advice.
>  Basically, in one aspect, I am declaring a function on a
>  class....Actually, code might help this.
>
>  class HappyClass {
>  }
>
>  aspect HappyAspect {
>   Foo HappyClass.foo = null;
>
>   public void HappyClass.doFoo() {
>    foo = new Foo();
>   }
>  }
>
>  aspect OtherAspect {
>   after(Foo f) : call(Foo.new()) && target(f) && within(HappyClass) {
>    // Do something cool here
>   }
>   after(Foo f) : call(Foo.new()) && target(f) &&
>  withincode(HappyClass.doFoo()) {
>    // Do something cool here
>   }
>   after(Foo f) : call(Foo.new()) && target(f) && within(HappyAspect) {
>    // Do something cool here
>   }
>   after(Foo f) : call(Foo.new()) && target(f) {
>    // Do something cool here
>   }
>  }
>
>  Note that this does not apply, it says the advice did not match.  None
>  of the above advice applies.  Is there some trick I need to use to
>  aspect on function calls within injected methods?  Is this even
>  possible?  How would I do it if it is possible?
>
>  Thanks in advance,
>  Kendall
>  _______________________________________________
>  aspectj-users mailing list
>  aspectj-users@xxxxxxxxxxx
>  https://dev.eclipse.org/mailman/listinfo/aspectj-users
>



--
Eric Bodden
Sable Research Group
McGill University, MontrÃal, Canada


------------------------------

Message: 6
Date: Mon, 12 May 2008 20:09:30 -0300
From: "Thiago Souza" <tcostasouza@xxxxxxxxx>
Subject: [aspectj-users] AspectJ5 and hot code replacement
To: aspectj-users@xxxxxxxxxxx
Message-ID:
       <e5b01e310805121609h70ef81f5me9df3aea559e1d@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1

Hi,

   We've been using AspectJ5 through Java5 LTW, but unfortunately,
we've lost the hot code replacement feature that's very import during
development journeys (new code is not loaded with aspectj saying that
"AspectJ5 does not weave hotswapped class"). Is there any way to do
hot code replacement with LTW? (I've tried different ways, even with
WeavingURLClassLoader with no success)

Regards,
Thiago Souza


------------------------------

Message: 7
Date: Mon, 12 May 2008 16:31:16 -0700
From: "Andy Clement" <andrew.clement@xxxxxxxxx>
Subject: Re: [aspectj-users] AspectJ5 and hot code replacement
To: aspectj-users@xxxxxxxxxxx
Message-ID:
       <689d61aa0805121631y8285ddep51c926974da8b581@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1

Please take a look at the enhancement request for this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=120375

In comment #7 I attached a patch that can be applied to a recent
weaver jar to remove the restriction - however
I have put nothing into the codebase as yet as I'm waiting on feedback
on how it behaves.

cheers,
Andy.

2008/5/12 Thiago Souza <tcostasouza@xxxxxxxxx>:
> Hi,
>
>     We've been using AspectJ5 through Java5 LTW, but unfortunately,
>  we've lost the hot code replacement feature that's very import during
>  development journeys (new code is not loaded with aspectj saying that
>  "AspectJ5 does not weave hotswapped class"). Is there any way to do
>  hot code replacement with LTW? (I've tried different ways, even with
>  WeavingURLClassLoader with no success)
>
>  Regards,
>  Thiago Souza
>  _______________________________________________
>  aspectj-users mailing list
>  aspectj-users@xxxxxxxxxxx
>  https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


------------------------------

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


End of aspectj-users Digest, Vol 39, Issue 11
*********************************************



--
Prof S Kotrappa
Assistant Prof,
Department of CSE/MCA
KLES's College of Engg., & Technology
Belgaum-India.