Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Introducing constructor with parameters



Andre,

Unfortunately the trick of using an ITD on an interface and implementing
that interface (perhaps with a declare parents statement ) that can be used
with methods cannot be used for constructors. Are you suggesting that the
ITD should fail silently? Are you trying to create a robust aspect that
will survive changes in the base code? This is usually the motivation when
writing pointcuts for dynamic cross-cutting. However with static
cross-cutting you cannot use type patterns or wildcards so the declarations
are more specific and hence closely coupled to the target type although
still ensuring good modularity. Being told the ITD has failed is probably
desirable as it may indicate the modularity has been broken.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/


André Dantas Rocha <ad-rocha@xxxxxxxxxx>@eclipse.org on 28/09/2004 19:07:58

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:    aspectj-users-admin@xxxxxxxxxxx


To:    <aspectj-users@xxxxxxxxxxx>
cc:
Subject:    [aspectj-users] Introducing constructor with parameters


Hi,

I'm trying to write an aspect to introduce a constructor in a particular
class. The problem is that if the class already has the constructor the
compilation fails. Is there a way to fix it?

public mypackage.MyClass.new(String name) {
  super(name);
  System.out.print(" Aditional constructor. ");
}

Thanks,

André





Back to the top