[abc-users] weaving JDK classes & class order problem

From: Alex Villazon <alex.villazon_at_lu.unisi.ch>
Date: Thu, 8 May 2008 12:45:19 +0200

On May 7, 2008, at 6:48 PM, Pavel Avgustinov wrote:

> On Wednesday 07 May 2008 17:39:27 Alex Villazon wrote:
>
>>
>> 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.
>
> Looks like for some reason Set is not considered a supertype of
> HashSet(). I'm
> not sure why this could be, but it always worries me to have several
> jars on
> the classpath containing the same classes, as in my experience that
> often
> leads to odd interactions.

Hi Pavel,

     I think this problem is related to the order of the classes to be
woven in the jar that I reported in another mail..

   I now tried to reproduce the same for this particular case. I first
try to put the java/util with the default order, and the aspect fails
to compile.. as you said, it looks like Set is not considered as
supertype of HashSet...

villazon_at_villazon-desktop:~/JDK$ jar cvf ../myrt.jar java/util/
villazon_at_villazon-desktop:~/$ java -cp /home/villazon/abc/lib/abc-ja-
complete.jar abc.main.Main -verbose -injars myrt.jar -sourceroots
simpleabc/ -outjar abcaspect.jar -debug dontCheckExceptions
abc started on Thu May 08 11:26:27 GMT+01:00 2008
/home/villazon/simpleabc/Dummy.java:8: 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.

  Then, I put java.util.Set in first position in the jar... and the
weaver seem to have an infinite recursion here... This time abc.ja
extension failed as well :-(

   Any idea from where the bug comes from? I have empty CLASSPATH,
and I'm passing abc in the -cp of java. Normally it shouldn't be any
confusion between the JDK classes used by abc, and those passed in -
injars to be woven... strange...

Many thanks,

Alex

villazon_at_villazon-desktop:~/$ cd JDK
villazon_at_villazon-desktop:~/JDK$ jar cvf ../myrt.jar java/util/
Set.class java/util/
villazon_at_villazon-desktop:~/JDK$ cd ..
villazon_at_villazon-desktop:~/$ java -cp /home/villazon/abc/lib/abc-ja-
complete.jar abc.main.Main -verbose -injars myrt.jar -sourceroots
simpleabc/ -outjar abcaspect.jar -debug dontCheckExceptions
abc started on Thu May 08 11:22:21 GMT+01:00 2008
No main class given. Inferred 'java.util.prefs.Base64' as main class.
Exception in thread "main" polyglot.util.InternalCompilerError:
unhandled exception during weaving/optimisation
         at abc.main.CompileSequence.runSequence(CompileSequence.java:
142)
         at abc.main.Main.run(Main.java:406)
         at abc.main.Main.main(Main.java:144)
Caused by: java.lang.OutOfMemoryError: Java heap space
         at soot.jimple.toolkits.base.JimpleConstructorFolder
$Fact.<init>(JimpleConstructorFolder.java:85)
         at soot.jimple.toolkits.base.JimpleConstructorFolder
$Fact.<init>(JimpleConstructorFolder.java:84)
         at soot.jimple.toolkits.base.JimpleConstructorFolder
$Analysis.newInitialFlow(JimpleConstructorFolder.java:157)
         at
soot
.toolkits
.scalar.ForwardFlowAnalysis.doAnalysis(ForwardFlowAnalysis.java:86)
         at soot.jimple.toolkits.base.JimpleConstructorFolder
$Analysis.<init>(JimpleConstructorFolder.java:151)
         at
soot
.jimple
.toolkits
.base
.JimpleConstructorFolder
.internalTransform(JimpleConstructorFolder.java:199)
         at soot.BodyTransformer.transform(BodyTransformer.java:51)
         at
abc.weaving.matching.AdviceApplication.doMethod(AdviceApplication.java:
246)
         at
abc
.weaving
.matching.AdviceApplication.computeAdviceLists(AdviceApplication.java:
312)
         at
abc
.weaving
.aspectinfo.GlobalAspectInfo.computeAdviceLists(GlobalAspectInfo.java:
482)
         at abc.main.CompileSequence.weave(CompileSequence.java:447)
         at abc.main.CompileSequence.runSequence(CompileSequence.java:
115)
         ... 2 more
Received on Thu May 08 2008 - 11:45:42 BST

This archive was generated by hypermail 2.2.0 : Thu May 08 2008 - 12:20:11 BST