Finding the declaring class of a _Jv_Field

Tom Tromey tromey@cygnus.com
Sun Oct 29 14:44:00 GMT 2000


>> Or am I missing something?

Mark> I thought that gave you the type of the field. I need the class
Mark> in which the field is declared. But it might be that I am
Mark> missing something myself.

Yes, you're right.  Sorry about that.

There is no way to go from a _Jv_Field to the enclosing Class.  You
have to just keep the class around.  Presumably you had the class at
some earlier point, since you need the Class to get the _Jv_Field.

If you look at JNI you'll see that the `ToReflectedField' method
requires the user to pass in the Class by hand.  _Jv_Field is
basically the same as jfieldID (by design).

Tom


More information about the Java mailing list