Hi,
     I'm trying to weave an aspect to JDK classes with abc, but I have  
some problems.
     We have a framework that allows instrumentation on JDK classes  
called FERRARI http://www.inf.unisi.ch/faculty/binder/documents/pppj07.pdf
that handles bootstrapping issues and we successfully woven several  
aspects such as DJProf http://www.mcs.vuw.ac.nz/~djp/djprof/ using  
AspectJ's ajc compiler into the JDK.
     Now, we want to adapt abc to our framework, but I have some  
problems and very few debugging information to understand what is wrong.
(I'm using JDK1.5 on linux and the last release of abc)
    To simplify, I put in myrt.jar only java/util and try to weave  
this simple aspect.
public final aspect Dummy {
  pointcut traced(): call(* *(..)) && !within(Dummy);
   before(): traced() { System.out.println("traced");}
}
  This works almost without problem ( I had to remove from myjar java/ 
util/Formatter*, java/util/ResourceBundle* and java/util/regex/ 
Pattern* because of the following errors reported by abc
Formatter.java:2309: The exception java.lang.Throwable must be either  
caught
     or declared to be thrown
ResourceBundle.java:1101: The exception java.lang.Throwable must be  
either
     caught or declared to be thrown
Pattern.java:5080: The exception java.lang.Throwable must be either  
caught or
     declared to be thrown
)
  After removing these files, abc was able to weave the aspect to  
myrt.jar
  Then, I added to my Dummy aspect the following declaration (that  
uses java.util classes which I'm weaving...)
  static private Set  _refs = new HashSet();
This time, abc failed to compile even the aspect itself...
  abc -verbose -injars myrt.jar    -sourceroots simpleabc/ -outjar  
abcrt.jar
abc started on Wed May 07 16:46:06 GMT+01:00 2008
/home/villazon/simpleabc/Dummy.java:10:
     The type of the variable initializer "java.util.HashSet" does not  
match
     that of the declaration "java.util.Set".
     static private Set _refs = new HashSet();
                                ^-----------^
1 error.
  My questions are question:
- Is there some restriction on abc to compile JDK classes?
- Could it be that the compiler has some conflicts because the classes  
java.util.Set and java.util.HashSet used to compile the aspect are not  
those from the original rt.jar but those that will be woven from  
myrt.jar ?
   Curiously, when I removed java.util.Set from myrt.jar, then the  
aspect was woven correctly. (nornally Set is an interface and should  
not be woven..)
  I also tried to tell polyglot to use the original rt.jar with  
+polyglot -bootclasspath  $JAVA_HOME/jre/lib/rt.jar -polyglot  but it  
does not work.
Any help will be strongly appreciated,
Cheers,
Alex
Received on Wed May 07 2008 - 17:39:51 BST
This archive was generated by hypermail 2.2.0 : Wed May 07 2008 - 17:50:12 BST