BCEL ClassLoader
Matthijs Wensveen <[email protected]>
| Newsgroups | gmane.comp.jakarta.bcel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello, I am not a member of the bcel-dev mailing list because I've only just begun using BCEL. I hope you don't mind me mailing directly to the list. I was experimenting with the BCEL ClassLoader, trying to get it working as the default classloader without using a bootstrapping Main class. It's possible to do this with the java.system.class.loader system property. The only thing is that the default deferTo variable of org.apache.bcel.util.ClassLoader is set to java.lang.ClassLoader.getSystemClassLoader(). This results in infinite recursion because java.lang.ClassLoader will try to instantiate org.apache.bcel.util.ClassLoader etc etc. This results in a IllegalStateException: recursive invokation I think the solution is to set the default value for deferTo to getParent(), and have the constructors that get a deferTo parameter call super(deferTo) as the first statement. Bootstrapping will still be possible but setting java.system.class.loader will also work correctly. I have already tested this and it works for me. However, I am very new to BCEL and I don't know what other consequences might be. FYI, I want to use BCEL to make a AspectJ-like AOP implementation, but instead of defining new language constructs I want to use metadata annotations to define Aspects and Pointcuts. Also, I want the system to insert the aspect's code at runtime. I am just experimenting with some things right now. If code samples are needed/wanted, I would be happy to provide them. Best regards, Matthijs Wensveen