I stand corrected :)

Andy

On 10 May 2010 09:31, Olle Hallin <[email protected]> wrote:
> I found the answer myself:
> import org.aspectj.lang.JoinPoint;
> import org.aspectj.lang.Signature;
> import org.aspectj.runtime.reflect.Factory;
>     private void enumeratePublicMethods(String className) {
>         try {
>             Class<? extends Object> clazz = Class.forName(className);
>             for (Method m : clazz.getMethods()) {
>                 JoinPoint.StaticPart jpsp = Factory.makeEncSJP(m);
>                 String methodName = jpsp.getSignature().toLongString();
>                 unusedMethods.add(methodName);
>             }
>         } catch (ClassNotFoundException e) {
>             e.printStackTrace(System.err);
>         }
>     }
> Olle Hallin
> Senior Java Developer and Architect
> [email protected]
> www.crisp.se
> http://www.linkedin.com/in/ollehallin
>
>
>
> 2010/5/10 Olle Hallin <[email protected]>
>>
>> Hi,
>> I'm working on my DeadCodeDetector aspect in my spare time, and now it
>> detects constructed but unused classes (by using a combination of
>> staticinitialization and execution pointcuts).
>> Now I want to continue and make it detect unused public methods.
>> For this I intend to use reflection in the after class loading advice, and
>> insert one string for each public method in a Set<String> unusedMethods,
>> which later can be removed by the after public method execution advice.
>> So what I need is to transform a java.lang.reflect.Method to a
>> org.aspectj.lang.Signature. How do I do that?
>> Olle Hallin
>> Senior Java Developer and Architect
>> [email protected]
>> www.crisp.se
>> http://www.linkedin.com/in/ollehallin
>>
>
>
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to