[jboss-user] [Javassist] New message: "Re: Remove an interface from a Class"
Kevin Kilroy
do-not-reply at jboss.com
Thu Feb 25 05:05:55 EST 2010
User development,
A new message was posted in the thread "Remove an interface from a Class":
http://community.jboss.org/message/528398#528398
Author : Kevin Kilroy
Profile : http://community.jboss.org/people/kevinkilroy
Message:
--------------------------------------------------------------
Hi,
Could you provide an example please? I'm receiving the following exception:
java.lang.LinkageError: loader (instance of sun/misc/Launcher$AppClassLoader): attempted duplicate class definition
With this code:
ClassPool pool = ClassPool.getDefault();
CtClass cc = pool.get("com.northwales.ilm.domain.ContextBarItem");
CtClass[] ifs = cc.getInterfaces();
CtClass[] newIfs = new CtClass[1];
newIfs[0] = ifs[0];
cc.setInterfaces(ifs);
cc.writeFile();
Class newClass = cc.toClass();
ContextBarItem cbi = (ContextBarItem)newClass.newInstance();
Thanks!
Kevin.
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/528398#528398
More information about the jboss-user
mailing list