[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bcel-dev
Subject:    Re: Incompatible field Types
From:       Shrinivas Joshi <sjoshi () cc ! gatech ! edu>
Date:       2005-06-19 0:11:49
Message-ID: Pine.GSO.4.58.0506182007090.1883 () tokyo ! cc ! gatech ! edu
[Download RAW message or body]

Hi All,
  With reference to below mail, I just wanted to let you know that
the same code works without any problem if I have an assignment of the
form
   String testString = b.g;
It fails only when I try to assign field of class A with value of field of
class B. Regular variable assignment just works fine.

Thanks and Regards
Shrinivas Joshi.


On Sat, 18 Jun 2005, Shrinivas Joshi wrote:

> 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
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic