Incompatible field Types

Shrinivas Joshi <[email protected]>
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
Hi All,
  Below r the e.g classes that I m having problem with.

public  class A {
   public String f;

   public A(B b)
   {
	f = b.g;
   }
   public static void main(String arg[])
   {
	A a = new A(new B);
   }

}

public class B {
   public String g;
   public B()
   {
	g = "TEST";
   }
}

The statement f = b.g compiles into

getfield g of B
putfield f of A

I am changing these 2 instructions into

INVOKE* method //which returns object of Object type
checkcast java/lang/String
putfield f of A

But this gives VerifyError saying : Incompatible type for
getting or setting field

Please let me know whether I m missing something over here.

Thanks and Regards
Shrinivas Joshi
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.