You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Kristian Rosenvold <kr...@gmail.com> on 2014/04/02 09:32:07 UTC
Graphing classloading ?
I've been wondering if there exists a java tool that would let me graph
classloading, so that I can track stuff like "this class is being used only
through this library" and that might even be able to give me what-if
analysis of what would happen if I replaced that specific dependency with
another alternative. I am thinking about the run-time class loading here,
not really static analysis.
I am assuming some kind of instrumentation of the linking phase of
classloading, not even sure it's possible... ?
(I know this is slightly off-topic, but it would certainly be applicable to
making some plugins faster)
Kristian
Re: Graphing classloading ?
Posted by Alexander Kriegisch <al...@kriegisch.name>.
Kristian,
have you tried AspectJ? It is actually quite easy to write an aspect which can do that for you.
--
Alexander Kriegisch
Kristian Rosenvold schrieb am 02.04.2014 09:32:
> I've been wondering if there exists a java tool that would let me graph
> classloading, so that I can track stuff like "this class is being used only
> through this library" and that might even be able to give me what-if
> analysis of what would happen if I replaced that specific dependency with
> another alternative. I am thinking about the run-time class loading here,
> not really static analysis.
>
> I am assuming some kind of instrumentation of the linking phase of
> classloading, not even sure it's possible... ?
>
> (I know this is slightly off-topic, but it would certainly be applicable to
> making some plugins faster)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Graphing classloading ?
Posted by Jason van Zyl <ja...@takari.io>.
You can create an agent that will has a method that will notify you when a class is about to be loaded where you can analyze or mutate the class. You could build the graph dynamically. A decent introduction that I looked at a while ago:
http://blog.javabenchmark.org/2013/05/java-instrumentation-tutorial.html
On Apr 2, 2014, at 3:32 AM, Kristian Rosenvold <kr...@gmail.com> wrote:
> I've been wondering if there exists a java tool that would let me graph
> classloading, so that I can track stuff like "this class is being used only
> through this library" and that might even be able to give me what-if
> analysis of what would happen if I replaced that specific dependency with
> another alternative. I am thinking about the run-time class loading here,
> not really static analysis.
>
> I am assuming some kind of instrumentation of the linking phase of
> classloading, not even sure it's possible... ?
>
> (I know this is slightly off-topic, but it would certainly be applicable to
> making some plugins faster)
>
> Kristian
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder, Apache Maven
http://twitter.com/jvanzyl
http://twitter.com/takari_io
---------------------------------------------------------
Selfish deeds are the shortest path to self destruction.
-- The Seven Samuari, Akira Kurosawa