I think what is happening is that post obfuscation your class has been named 'a/Print' but the string reference in the joinpoint is still 'hmil.Print'. The AspectJ runtime actually tries to resolve the class before returning the name (i.e. getDeclaringTypeName() calls getDeclaringType().getName()). The error handling will return a ClassNotFoundException.class when hmil.Print cannot be resolved.
Can you tell the obfuscator to also modify string references to types? You might like it to avoid resolving in this case and just return the string, but currently you can't do that. It hasn't been made configurable because I think it is unusual that it can't resolve the class it is in... The string form of the declaringType isn't even stored in the signature object for you to access via reflection, the ctor converts it to a class reference straight away... Andy On 24 January 2013 15:12, Hmil P <a...@hp.com> wrote: > Hello, > > So I am using AspectJ to profile some methods and would like to extract the > method name and enclosing class via: > 1. jpsp.getSignature().getName() for method name > 2. jpsp.getSignature().getDeclaringTypeName() for declaring class name > > However, the catch is that my java code is first instrumented by AspectJ > and > *then obfuscated by Zelix KlassMaster*. Because of this > jpsp.getSignature().getDeclaringTypeName() returns > "java.lang.ClassNotFoundException". > > I used JAD to decompile the AspectJ-generated code and saw that the > following code is inserted into the woven class (hmil.Print): > /Factory factory = new Factory("Print.java", hmil / Print); > ajc$tjp_0 = factory.makeSJP("method-execution", > factory.makeMethodSig("echo", "hmil.Print", "int", "num", "", "int"), 40);/ > > Even after Zelix KlassMaster runs (and basically renames the class > hmil.Print to a.Print), the AspectJ inserted code simply changes to: > /Factory factory = *new Factory("Print.java", a / Print);* > ajc$tjp_0 = factory.makeSJP("method-execution", > factory.makeMethodSig("echo", "hmil.Print", "int", "num", "", "int"), 40);/ > > > Because of this, I believe that the static joinpoint still contains the > enclosing class name ("hmil.Print"). How can I access this information > without getting a ClassNotFoundException? > > Thanks in advance. > > > > -- > View this message in context: > http://aspectj.2085585.n4.nabble.com/jpsp-getSignature-getDeclaringTypeName-returns-java-lang-ClassNotFoundException-tp4650751.html > Sent from the AspectJ - users mailing list archive at Nabble.com. > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > https://dev.eclipse.org/mailman/listinfo/aspectj-users >
_______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org https://dev.eclipse.org/mailman/listinfo/aspectj-users