Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Anonymous classes unaware of introductions into abstract classes

Matthew,

This is fairly strange. I tested the example on both
Windows and Linux (3 different machines), command line
and Eclipse. I got the same error. Once again, if I
comment out the anonymous class, the code compiles - I
would expect it not to compile if it is some
configuration problem. ConcreteClassA extends
AbstractClassA and does not implement a2(). So the
introduction works in that case.

I compile only ConcreteClassA.java because all the
code from my example is in that file.

Perhaps you could send me the code you compile and how
you compile it? 

Thanks,
Marius



--- Matthew Webster <matthew_webster@xxxxxxxxxx>
wrote:

> 
> 
> 
> 
> Marius,
> 
> I think you have some sort of configuaration
> problem: "error can't find
> type $Local$" concerns me. We can build you example
> on Windows and Linux at
> the command line and in Eclipse. Please check
> "CLASSPATH" etc.
> 
> BTW if you just compile ConcreteClassA.java you
> won't get woven hence the
> error.
> 
> 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/
> 
> 
> "Marius M." <marin_marius@xxxxxxxxx>@eclipse.org on
> 08/10/2004 14:31:59
> 
> Please respond to aspectj-users@xxxxxxxxxxx
> 
> Sent by:    aspectj-users-admin@xxxxxxxxxxx
> 
> 
> To:    aspectj-users@xxxxxxxxxxx
> cc:
> Subject:    Re: [aspectj-users] Anonymous classes
> unaware of introductions
>        into abstract classes
> 
> 
> Matthew,
> 
> Here is the error:
> 
> 
> $ ajc -version
> AspectJ Compiler 1.2 built on Friday May 21, 2004 at
> 15:06:22 GMT
> $ ajc ConcreteClassA.java
> error can't find type $Local$
> 
> /home/marin/tests/ConcreteClassA.java:18 error Class
> must implement the inherited abstract method
> InterfaceA.a2()
> InterfaceA a = new AbstractClassA() {
>                    ^^^^^^^^^^^^^
> 
> 2 errors
> --------
> 
> If you comment out the body of someMethod() (the
> anonymous class), it compiles without errors.
> 
> -- Marius
> 
> P.S. For Eclipse, too ..
> 
> 
> --- Matthew Webster <matthew_webster@xxxxxxxxxx>
> wrote:
> 
> >
> >
> >
> >
> > Marius,
> >
> > My mistake. However your example compiles with
> > AspectJ 1.2 and AJDT 1.1.12.
> > What errors do you get?
> >
> > 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/
> >
> >
> > "Marius M." <marin_marius@xxxxxxxxx>@eclipse.org
> on
> > 08/10/2004 12:51:27
> >
> > Please respond to aspectj-users@xxxxxxxxxxx
> >
> > Sent by:    aspectj-users-admin@xxxxxxxxxxx
> >
> >
> > To:    aspectj-users@xxxxxxxxxxx
> > cc:
> > Subject:    Re: [aspectj-users] Anonymous classes
> > unaware of introductions
> >        into abstract classes
> >
> >
> > Matthew,
> >
> > Perhaps I miss something, but I doubt it is the
> > "declare parents" statement. AbstractClassA
> > implements
> > InterfaceA already - the "declare parents" does
> not
> > add anything new, imo. Moreover, the introduction
> > works for the concrete, named class
> > (ConcreteClassA),
> > which extends AbstractClassA (note: the previous
> > version of the compiler reported errors for the
> > concrete class, too. The version 1.2 works fine.).
> > Thus, it's only the anonymous class that is
> unaware
> > of
> > introduction.
> >
> > BTW: does your aspect solution work for you?
> >
> >
> > Marius
> >
> >
> > --- Matthew Webster <matthew_webster@xxxxxxxxxx>
> > wrote:
> >
> > >
> > >
> > >
> > >
> > > Marius,
> > >
> > > You are missing something. Although you have an
> > > inter-type declared method
> > > for "a2()" on AbstractClassA the statement
> > > "AbstractClassA is a InterfaceA"
> > > is not true hence the compiler error:
> > >
> > >       Type mismatch: cannot convert from
> > <anonymous
> > > subclass of
> > > AbstractClassA> to InterfaceA
> > >
> > > You also need a declare parents statement:
> > >
> > > public aspect IntroAspectA {
> > >
> > >       declare parents : AbstractClassA
> implements
> > > InterfaceA;
> > >
> > >       public void AbstractClassA.a2() {
> > >
> > System.out.println("AbstractClassA.a2()
> > > from IntroAspectA");
> > >       }
> > > }
> > >
> > > 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/
> > >
> > >
> > > "Marius M." <marin_marius@xxxxxxxxx>@eclipse.org
> > on
> > > 07/10/2004 13:21:06
> > >
> > > Please respond to aspectj-users@xxxxxxxxxxx
> > >
> > > Sent by:    aspectj-users-admin@xxxxxxxxxxx
> > >
> > >
> > > To:    aspectj-users@xxxxxxxxxxx
> > > cc:
> > > Subject:    [aspectj-users] Anonymous classes
> > > unaware of introductions into
> > >        abstract classes
> > >
> > >
> > > Hello,
> > >
> > >
> > >  I couldn't find this problem reported as a bug,
> 
=== message truncated ===



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com


Back to the top