I am trying to execute the following piece of code.
System.out.println(originalElement);
System.out.println(uniqueParent);
((CtClass) originalElement).replace((CtClass) uniqueParent);
where
originalElement
is
class Already {}
and uniqueParent
is
class Already {
class Klass {}
}
However, when I try to replace originalElement
with uniqueParent
, it doesn't work. I have tried the replace API with other elements such as CtMethod
and it works there. I wanted to know if this is the intended behaviour with CtClass
or is it supposed to be a bug?