Bober02
Bober02

Reputation: 15351

JVM type representation on method area

Is there any reference which I could check on how Java developers decided to represent type information of a specific object? I know that the Class instance for a particular type is linked to that data structures and acts as an interface to it.

Upvotes: 4

Views: 210

Answers (2)

biziclop
biziclop

Reputation: 49794

If the question is about how this information is encoded in a class file, it's described here.

If you want to know how all this is represented in memory, your best bet is the source code of VM implementations.

Upvotes: 3

MALfunction84
MALfunction84

Reputation: 500

If you're writing a program, you can use reflection to access a class's fields (or methods).

public void dumpFields(Class clz) {
    for (Field f : clz.getDeclaredFields()) {
        System.out.println(f.toString());
    }
}

If you're dealing with a .class file, you can decompile it using JAD.

Upvotes: 1

Related Questions