Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: Extending standard java classes

"Andy Clement" <andrew.clement@xxxxxxxxx> writes:

Hi Andy,

>> I've thought that.  But with the command line ajc it works in a
>> reasonable time and resources.  (I can't tell if it acually works,
>> though, but at least it compiles. ;-))
>
> -showWeaveInfo is the command line option that will tell you if it is
>  weaving.

Ok, it seems to have worked and I got a weaver-rt.jar including the
standard java classes + my AValue interface.  I deleted the Java system
lib from my test project inside Eclipse and replaced it with the weaved
jar.

When I check the type hierarchy of Integer, it tells me that it
implements AValue, just like I wanted.

When I say

     AValue a = new Integer(2);
     System.out.println("instance of AValue? " + (a instanceof AValue));
	 System.out.println("Integer? " + a.isInteger() + ", Double? "
	   + a.isDouble() + ", String? " + a.isString());

no errors are shown, but when I run the program the instanceof test says
false and invoking the isFoo() methods, which are declared in the
interface AValue and have implementations in my aspect throw an
exception:

  Exception in thread "main" java.lang.IncompatibleClassChangeError:
    Class java.lang.Integer does not implement the requested interface AValue
	  at Test.main(Test.java:10)

I think I'm missing something obvious here, but what?

Bye,
Tassilo



Back to the top