method access$0() and Interfaces doubts
Hello All,
I am working on a class browser, I have created one and it works successfully to a certain extent. But The class which I am having a Demo for a Tree Implementation in GUI, has a method called access$0() which I guess is automatically created on runtime by the super classes or somewhere, please let me know how and where can I get more details about this method.
Also If my class under inspection is implementing one or more interfaces, how can I access its method names and variables.
Also One more question, does Java maintain a list of sub-class information for each class somewhere.. just like Small Talk or it doesn't? Please explain.
Thanks,
Sirish
# 1
> Hello All,
>
> I am working on a class browser, I have created one
> and it works successfully to a certain extent. But
> The class which I am having a Demo for a Tree
> Implementation in GUI, has a method called access$0()
> which I guess is automatically created on runtime by
> the super classes or somewhere, please let me know
> how and where can I get more details about this
> method.
how did you find this "method"?
> Also If my class under inspection is implementing one
> or more interfaces, how can I access its method names
> and variables.
same way you normally would. implemented methods are still methods. pretty sure you didn't ask what you meant to there.....
> Also One more question, does Java maintain a list of
> sub-class information for each class somewhere.. just
> like Small Talk or it doesn't? Please explain.
>
> Thanks,
> Sirish
no. it doesn't. you'll have to wander the classpath yourself picking them up
# 2
access$ methods are widely used to access private members of enclosing class from its inner class and vice-versa. These methods are generated by Java compiler, not by JVM runtime.
See http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#80128 for more details about synthetic class members.
Other questions need more clarification.
# 3
> access$ methods are widely used to access private
> members of enclosing class from its inner class and
> vice-versa. These methods are generated by Java
> compiler, not by JVM runtime.
> See
> http://java.sun.com/docs/books/jvms/second_edition/htm
> l/ClassFile.doc.html#80128 for more details about
> synthetic class members.
>
> Other questions need more clarification.
I will check that link, Regarding the other two questions:
2. What I meant in my interfaces question is that... Say I have a class X that Extends Y and implements A,B
Then if I want to display all the methods and fields of these classes and interfaces in a recursive way, till I reach the Object class, by going to superclass every time, then I understand I can get to class Y simple by
using x.getSuperClass()
but how can I get the interface methods? and go upwards in that hierarchy?
3. Sub class question is like this - Say I have 3 classes all user defined in the same directory Class A,B,C where A is the superclass of B and C. My class browser is displaying the hierarchy details of A, then is there any way to put in the details of B and C in the same hierarchical display or just display a separate list of subclass that this class has. I am not sure whether I have made it clear still.
(I didnot understnad your reply on changing the class path, can you please explain it in a bit more detail, provided it holds for this question.)
Regards,
Sirish