1

In .jca file documentation, it is mentioned that the constantpool section will look like this.

.constantPool {
        /*
         * The first six entries declare constant pool entries that
         * are contained in
         * other packages.
         * Note that superMethodRef are always declared internal
         * entry. 
         */
        classRef    0.0;     // 0    package token 0, class token 0
        instanceFieldRef 1.0.2;// 1  package token 1, class token 0,
                              //   instance field token 2
        virtualMethodRef 2.0.2; // 2 package token 2, class token 0,
                    //  instance field token 2
        classRef    0.3;  // 3 package token 0, class token 3
        staticFieldRef  1.0.4;   // 4 package token 1, class token 0,
                    //      field token 4
        staticMethodRef  2.0.5;  // 5 package token 2, class token 0,
                    //      method token 5
        /*
         * The next five entries declare constant pool entries
         * relative to this class.
         */
        classRef    test0;        // 6
        instanceFieldRef    test1/field1;        // 7
        virtualMethodRef    test1/method1()V;        // 8
        superMethodRef  test9/equals(Ljava/lang/Object;)Z;     // 9
        staticFieldRef    test1/field0;        // 10
        staticMethodRef    test1/method3()V;        // 11
    }

But in actual case my .constantPool directive looks like the following

.constantPool {
        // 0
        staticMethodRef Callmymenu/<init>()V;
        // 1
        classRef Callmymenu;
        // 2
        virtualMethodRef 0.3.1()V;      // javacard/framework/Applet.register()V
        // 3
        staticMethodRef 0.3.0()V;       // javacard/framework/Applet.<init>()V
        // 4
        virtualMethodRef 0.10.1()[B;        // javacard/framework/APDU.getBuffer()[B
        // 5
        staticMethodRef 0.7.1(S)V;      // javacard/framework/ISOException.throwIt(S)V
        // 6
        virtualMethodRef 0.3.3()Z;      // javacard/framework/Applet.selectingApplet()Z
    }

Can somebody please explain me that how to analyze my constantPool directive with the documentation standard.

Mayukh Sarkar
  • 2,289
  • 1
  • 14
  • 38

1 Answers1

2

(Assuming you are talking about this)

You should look into the Java Card Virtual Machine Specification to understand the purpose of the constant pool. The part of this 'documentation' you pasted into the question is just an example. Different classes have different constant pools.

AFAIK the main principle of java card constant pool is the same as in desktop java (with some constraints of course) -- thus you might want to look here or here to get started.

Good luck!

Community
  • 1
  • 1
vlp
  • 7,811
  • 2
  • 23
  • 51