Bonjour,
Je me demandais si certaines personnes avaient lu cet article et pouvaient m'expliquer ce "code" :
sachant que j'ai réussi à trouver ici cette déclaration de structure qui m'aide un peu :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 The following is an excerpt from the same constant pool that shows the BootstrapMethods attribute, which contains the array of bootstrap method specifiers: [3] { // Attributes // ... Attr(#235, 6) { // BootstrapMethods at 0x0F63 [1] { // bootstrap_methods { // bootstrap_method #233; // bootstrap_method_ref [0] { // bootstrap_arguments } // bootstrap_arguments } // bootstrap_method } } // end BootstrapMethods } // Attributes
Donc en faisant le lien entre les deux, je me rend compte qu'on link l'opérateur + (#235) à liste de méthodes bootstrap (ici il n'y en a qu'une Example.mybsm (#233)) qui renverra la bonne méthode à appeler (Integer.adder ici).
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 struct BootstrapMethods_attr { u2 name; // CONSTANT_Utf8 = "BootstrapMethods" u4 size; u2 bootstrap_method_count; struct bootstrap_method_specifier { u2 bootstrap_method_ref; // index to CONSTANT_MethodHandle u2 bootstrap_argument_count; u2 bootstrap_arguments[bootstrap_argument_count]; // constant pool indexes } bootstrap_methods[bootstrap_method_count]; }
Mais la question c'est pourquoi le nombre d'arguments est 0 alors que Example.mybsm en possède 3 ?
Je me demande aussi quelle est l’intérêt de pouvoir associer à une méthode plusieurs bootstraps ?
Merci
Partager