Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Intertype Questions after porting to 1.1.1

Just to clarify these two points...

(1) the bugs with inter-type declarations that
Paul saw are fixed in CVS.  It works to declare
public methods and use them via the interface
or concrete-class references in a subsequent compile.

(2) the programming guide in CVS states
that the constructors declared in an aspect must invoke
any other code required to initialize variables,
typically using this(): e.g.,

  aspect A {
       private int C.j;
       C.new(int i) {
           this();
           j = i;
       }
   }

The reason: compilers pull initializers into the init
code, so when *later* weaving bytecode to add a new
constructor, it needs to invoke that code.
This would be true of any bytecode-weaving implementation
(that didn't go back and reanalyze the existing constructors).

Thanks,
Wes

Paul Christmann wrote:
My mistake one one of my points, and I'd like to clarify for any others who may stumble on my note in the future. I wrote:

Paul Christmann wrote:

2. Introduced constructors seem to not invoke initializers on the class when invoked via reflection. Is this intended behavior?


As Ron and Wes pointed out, this should have been expected behavior for all introduced constructors, not just reflection.

And they were both correct; my tests to illustrate the behavior I was seeing were in fact wrong. When I corrected my tests, then I saw the behavior they described -- *any* introduced constructor results in initializers not being invoked.

Sorry for the confusion.




Back to the top