[jboss-user] [Javassist] - getDeclaringClass throws error

Ragnar Rova do-not-reply at jboss.com
Mon Jan 24 18:02:16 EST 2011


Ragnar Rova [http://community.jboss.org/people/rrva] created the discussion

"getDeclaringClass throws error"

To view the discussion, visit: http://community.jboss.org/message/582889#582889

--------------------------------------------------------------
Hi

Why does the following testcase fail with IncompatibleClassChangeError ?

package foo;
 
import javassist.*;
 
import org.junit.*;
 
public class GetDeclaringClassTest {
 
    static class Foo {
        String bar;
    }
 
    @Test
    public void get_declaring_class_should_not_throw_error()
            throws NotFoundException, CannotCompileException {
        ClassPool pool = ClassPool.getDefault();
        CtClass cc = pool.get(Foo.class.getName());
        cc.setName(Foo.class.getName() + "$BackRef");
        Class<?> klass = cc.toClass();
        klass.getDeclaringClass();
 
    }
}
 
 
 
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/582889#582889]

Start a new discussion in Javassist at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2062]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110124/7299dba7/attachment.html 


More information about the jboss-user mailing list