Re: [aspectwerkz-dev] important patch for AnnotationCTask

the_mindstorm <[email protected]> Tue, 02 Nov 2004 12:32:15 +0200
Newsgroups gmane.comp.java.aspectwerkz.devel
Message-ID <[email protected]>
Alex can you verify on your machine that the examples.logging.LogAnnotationProxy annotation is 
indeed used?

I have done the following:
1. added the following method to AnnotationManager:
[code]
   private void printCL(ClassLoader cl, int i) {
     	if(cl==null) {
     		return;
     	}
     	
  		System.out.println("CL" + i + "-->" + cl + " @" + cl.hashCode());
   		printCL(cl.getParent(), i+1);

   }
[/code]
than in
AnnotationManager.instantiateAnnotation:
System.out.println(proxyClass.getName());
printCL(proxyClass.getClassLoader());


I have logged everything and than tryied to find examples.logging.LogAnnotationProxy and haven't 
found it.

When I use the above code on my piece of code the result is the following:
custom annotation: net.noco.unit.aw.ContextAnnotationProxy
  [annoc] ========== net.noco.unit.aw.ContextAnnotationProxy ==========
  [annoc] CL0-->java.net.URLClassLoader@c79809 @13080585
  [annoc] CL1-->sun.misc.Launcher$AppClassLoader@53ba3d @5487165
  [annoc] CL2-->sun.misc.Launcher$ExtClassLoader@e80a59 @15207001
  [annoc] **********

while for Annotation.class:
[annoc] ========== Annotation ==========
[annoc] CL0-->org.apache.tools.ant.loader.AntClassLoader2@1a42792 @27535250
[annoc] CL1-->sun.misc.Launcher$AppClassLoader@53ba3d @5487165
[annoc] CL2-->sun.misc.Launcher$ExtClassLoader@e80a59 @15207001

so you see why the ClassCastException.

I wait for your comments.

:the_mindstorm

> 
> 
> Alex
> 
> 
> 
> On Tue, 02 Nov 2004 03:03:11 +0200, the_mindstorm
> <[email protected]> wrote:
>> Quote [Alexandre Vasseur]:
>> 
>> > Hi
>> >
>> > Would it be possible to have a sample / a test that shows the issue
>> > first ? How can I reproduce it on my side ?
>> >
>> > Thx
>> > Alex
>> 
>> Hi Alex!
>> 
>> Have you been able to reproduce the problem I was talking about? Do you need the test?
>> 
>> :the_mindstorm
>> 
>> 
>> 
>> >
>> >
>> > On Thu, 28 Oct 2004 23:59:20 +0300, the_mindstorm
>> > <[email protected]> wrote:
>> >> Hi!
>> >>
>> >> Playing around with the ant tasks for annotation and offline weaving I have found a problem while
>> >> compiling custom annotations.
>> >> It was again a problem regarding the classloaders: the classloader used for annotations was a
>> >> sibling of Ant class loader this giving some ClassCastExceptions in AnnotationManager.
>> >>
>> >> Attached is the patched version which uses the same mechanism as the one used for setting the class
>> >> loaders for AspectWerkzCTask.
>> >>
>> >> Please let me know what you think.
>> >>
>> >> :the_mindstorm
>> >>
>> >>
>> >>
>> >
>> 
>>
>