Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] LTW and JRE classes

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

That's not a weaver option, it is a JVM option for showing class loading. I thought pairing that with the -debug weaver option might show java types being loaded by the JVM and if there was no immediate weaver message then they weren't getting to the weaver.

It is interesting what classloaders weavers get attached to. I can't what the current class loader hierarchy is in Java8 - do you only see the one weaver attached to application related class loader? 

cheers,
Andy

On Sat, 28 Mar 2020 at 00:31, Alexander Kriegisch <alexander@xxxxxxxxxxxxxx> wrote:
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
> <alexander@xxxxxxxxxxxxxx <mailto:alexander@xxxxxxxxxxxxxx>
> > 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@xxxxxxxxxxx
>> <mailto:aspectj-users@xxxxxxxxxxx>
>> To unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/aspectj-users
>

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

Back to the top