JNI: cannot access member of superclass via subclass
Godmar Back
gback at cs.utah.edu
Tue May 25 14:30:22 PDT 1999
Let me follow up with what I learned from Gilad Bracha about field resolution,
in case anybody is interested.
1. The compiler is wrong to compile accesses the way it does. See
http://java.sun.com/docs/books/jls/public-symref-compilation-rules.html
The JLS was changed, but no javac compiler implements the change yet.
2. Not searching for fields in direct superinterfaces is a bug in the JDK.
http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#71685
says:
When resolving a field reference, field resolution first attempts to
look up the referenced field in C and its superclasses:
1. If C declares a field with the name and descriptor specified by
the field reference, field lookup succeeds. The declared field is
the result of the field lookup.
2. Otherwise, field lookup is applied recursively to the direct
superinterfaces of the specified class or interface C.
3. Otherwise, if C has a superclass S, field lookup is applied
recursively to S.
4. Otherwise, field lookup fails.
Kaffe is "bug-compatible" for now.
3. This means vm/#17 is indeed a bug that should be fixed.
- Godmar
More information about the kaffe
mailing list