Re: Coping methods

Stephen Kolaroff <[email protected]>
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
well, there should be some kind of misunderstanding.
I took a lok at the copy implementation. And mentioned that all 
constants from original CP are copied to the destination CP. Which is 
perfect.
My question was, isn't it better to take care of references to fields 
and method of the original class (this.field = 100 to be copied as 
this.field=100 in the other class). Moreover, I pointed that the current 
method copy produces incorrect (In JVMspec sense) result when 
transfering such this.smth references. Such incorrectnest, though, is 
perfectly correct as long as you, bcel developers, state that 
MethodGen.copy must behave as behave now.

Meanwhile, I do implement my metod copy (actuall, whole class copy):
class One {
int filed;
void putfield() {field=100;}
}

class Another {
}

copy One to Another:
class Anoter {//after copy
int field;
void putfield() {field=100;}
}

Markus Dahm wrote:
> You probably forgot to copy the ConstantPool as well. Alternatively you have
> to copy the referenced entries and set the indexes by hand.
> 
> Cheers
>   Markus
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.