Hi Andy.

Actually, I am still running Java 8, so modules are not an issue here.

Furthermore, both '-verbose:class' and '-verbose=class' yield warnings:

  [MethodUtil@1e51f2fa] warning
  Cannot configure weaver with option '-verbose:class':
  unknown option

I run with these settings:

<weaver options="-showWeaveInfo -verbose -debug 
-Xset:weaveJavaxPackages=true,weaveJavaPackages=true">
  <include within="javax..*"/>
  <include within="java..*"/>
  <include within="org.aspectj..*"/>
</weaver>

I see nothing on the console indicating that any JRE classes are even
visible to the classloader. I even created a main class starting my
other main class via Class.forName(), Class.getMethod() and
Method.invoke() in order to avoid javax or java JRE imports in my main
class, trying to avoid that the weaver kicks in too late. It seems as if
the weaver does not get attached to the right classloader. Should I do
more than just '-javaagent:...' and also add the weaver to the boot
classpath or something?

I found a test related to javax classes, but that one is kinda cheating
because it tests with own classes in javax package not with real JRE
classes:

https://github.com/eclipse/org.aspectj/tree/master/tests/features160/weavingJavaxPackage

I really need some help to get started here.
-- 
Alexander Kriegisch
https://scrum-master.de


Andy Clement schrieb am 28.03.2020 00:51 (GMT +07:00):
> 
> 
> I feel like they used to work but there were gotchas. For example the JVM
> loads up some types before the LTW infrastructure can even get involved
> and those can't be woven. I don't actually recall if we have testcases for
> this but I wouldn't be surprised if they weren't there. I guess you have
> tried them and they don't work - I wonder if you were test weaving
> something that would be loaded early? It would be interesting to attempt
> it with a -verbose:class and verify not attempting to weave things loaded
> before the 'LTW is active' type messages come out. Will it work with
> modules in recent Javas? That seems unlikely.
> 
> But it could be the kind of classloaders in use in regular Java now don't
> allow weaver attachment, I honestly haven't kept up to speed on that - and
> maybe that prevents them working at all. A run of LTW with the debug
> option on for the weaver should show the types the weaver is being exposed
> to. If those are java/javax then they should be weavable.
> 
> cheers,
> Andy
> 
> 
> On Fri, 27 Mar 2020 at 04:03, Alexander Kriegisch
> <alexan...@kriegisch.name <mailto:alexan...@kriegisch.name>
> > wrote:
> 
>> Hallo Andy and other maintainers.
>> 
>> The AspectJ documentation still mentions things like
>> 
>> -Xset:weaveJavaxPackages=true
>> -Xset:weaveJavaPackages=true
>> 
>> or for LTW
>> 
>> <include within="javax.*"/>
>> <include within="java.*"/>
>> <include within="org.aspectj.*"/>
>> 
>> (I think "java..*" would be correct syntax, BTW.)
>> 
>> None of these work. Yes, there are valid cases in which users might want
>> to use LTW on JRE classes. The only way I could ever weave into the JRE
>> (execution joinpoints, not just call from my own woven code) was binary
>> weaving and creating my own (subset of) JRE, prepending it to the boot
>> classpath. But that's not nice and I never tried with modularised Java
>> 9+, which might work or not.
>> 
>> Before I create a Bugzilla ticket I would like to get a maintainer
>> opinion. Is there any chance to make this work with AspectJ LTW? Is is
>> maybe possible already and I just do it wrong?
>> 
>> Regards
>> --
>> Alexander Kriegisch
>> https://scrum-master.de
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@eclipse.org
>> <mailto:aspectj-users@eclipse.org> 
>> To unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/aspectj-users
> 

_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to