On Thu, 14 Sep 2000, Sandeep Tamhankar wrote:

> I have the following two class definitions:
> 
> public class myclass {
>     private int priv;
>     public int f1;
>     public int f2;
>     public static int stat=5;
>     public myclass () {
>         f1=7;
>     }
>     public void setF2(int i) {
>         f2=i;
>     }
>     public int getF2() {
>         return f2;
>     }
> }
> 
> public class mysubclass extends myclass {
>     public int sub1;
> }
> 
> I execute the following Tcl code to introspect my two classes, and there
> seems to be some kind of inconsistency.  java::info on mysubclass
> returns all of its fields as well as its parents; however it seems that
> I can't use java::field to actually get/set the values of those fields:
> 
> % package require java
> 1.2.5
> % java::info fields -type mysubclass
> {int f1} {int f2} {int sub1}
> % java::info fields -type -static mysubclass
> {int stat}
> % set obj [java::new mysubclass]  
> java0x1
> % java::field $obj sub1
> 0
> % java::field $obj f1
> field "f1" doesn't exist
> % java::field $obj stat
> field "stat" doesn't exist
> 
> If I mess around with the parent class containing those fields, things
> work out:
> 
> % java::field myclass stat
> 5
> % set sobj [java::new myclass]
> java0x2
> % java::field $sobj stat
> 5
> 
> This seems to be a big bug to me.  Am I doing something wrong, or is
> there something wrong with Blend? Thanks.
> 
> -Sandeep


This is a known bug. You have a couple of options, there
is a "quick fix" that you can use (see below). There is
also a "less quick fix" that involves a small hack to
the source code. The real fix is of course much harder.
I know how to fix it, but I just have not had time to
do it. Of course, if someone wants to volunteer to write
some code and regression tests, I would be glad to
explain how to implement the fix.

Remember, the mailing list archive is your friend.
Use is, it has a nice search feature that can save
you time and heartache.

http://www.mail-archive.com/tcljava@scriptics.com/


The original problem:

http://www.mail-archive.com/tcljava@scriptics.com/msg00490.html
http://www.mail-archive.com/tcljava@scriptics.com/msg00040.html

The "quick fix" (where Quick != Correct)

http://www.mail-archive.com/tcljava@scriptics.com/msg00492.html

A discussion of the real fix, and why it is hard:

http://www.mail-archive.com/tcljava@scriptics.com/msg00806.html

Mo DeJong
Red Hat Inc

----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
An archive is available at http://www.mail-archive.com/tcljava@scriptics.com

Reply via email to