यह दस्तावेज़ .dex
फ़ाइलों के लेआउट और सामग्री का वर्णन करता है, जिनका उपयोग वर्ग परिभाषाओं और उनके संबद्ध सहायक डेटा के एक सेट को रखने के लिए किया जाता है।
प्रकार के लिए गाइड
नाम | विवरण |
---|---|
बाइट | 8-बिट साइन इन |
यूबाइट | 8-बिट अहस्ताक्षरित int |
कम | 16-बिट हस्ताक्षरित इंट, लिटिल-एंडियन |
उशॉर्ट | 16-बिट अहस्ताक्षरित इंट, लिटिल-एंडियन |
पूर्णांक | 32-बिट हस्ताक्षरित इंट, लिटिल-एंडियन |
यूंट | 32-बिट अहस्ताक्षरित इंट, लिटिल-एंडियन |
लंबा | 64-बिट हस्ताक्षरित इंट, लिटिल-एंडियन |
उलॉन्ग | 64-बिट अहस्ताक्षरित इंट, लिटिल-एंडियन |
स्लेब128 | हस्ताक्षरित LEB128, चर-लंबाई (नीचे देखें) |
यूलेब128 | अहस्ताक्षरित LEB128, चर-लंबाई (नीचे देखें) |
uleb128p1 | अहस्ताक्षरित LEB128 प्लस 1 , चर-लंबाई (नीचे देखें) |
एलईबी128
LEB128 (" L ittle- E ndian B as 128 ") मनमाने ढंग से हस्ताक्षरित या अहस्ताक्षरित पूर्णांक मात्राओं के लिए एक चर-लंबाई एन्कोडिंग है। प्रारूप को DWARF3 विनिर्देश से उधार लिया गया था। एक .dex
फ़ाइल में, LEB128 का उपयोग केवल 32-बिट मात्राओं को एन्कोड करने के लिए किया जाता है।
प्रत्येक LEB128 एन्कोडेड मान में एक से पांच बाइट्स होते हैं, जो एक साथ एक 32-बिट मान का प्रतिनिधित्व करते हैं। अनुक्रम में अंतिम बाइट को छोड़कर प्रत्येक बाइट का अपना सबसे महत्वपूर्ण बिट सेट होता है, जिसमें इसका सबसे महत्वपूर्ण बिट स्पष्ट होता है। प्रत्येक बाइट के शेष सात बिट पेलोड हैं, पहली बाइट में मात्रा के कम से कम महत्वपूर्ण सात बिट्स, दूसरे बाइट में अगले सात और इसी तरह। एक हस्ताक्षरित LEB128 ( sleb128
) के मामले में, अनुक्रम में अंतिम बाइट का सबसे महत्वपूर्ण पेलोड बिट अंतिम मान उत्पन्न करने के लिए साइन-विस्तारित है। अहस्ताक्षरित मामले ( uleb128
) में, स्पष्ट रूप से प्रतिनिधित्व नहीं किए गए किसी भी बिट की व्याख्या 0
के रूप में की जाती है।
दो-बाइट LEB128 मान का बिटवाइज़ आरेख | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
पहला बाइट | दूसरा बाइट | ||||||||||||||
1 | बिट 6 | बिट 5 | बिट 4 | बिट 3 | बिट 2 | बिट 1 | बिट 0 | 0 | बिट 13 | बिट 12 | बिट 11 | बिट 10 | बिट 9 | बिट 8 | बिट 7 |
संस्करण uleb128p1
का उपयोग एक हस्ताक्षरित मूल्य का प्रतिनिधित्व करने के लिए किया जाता है, जहां प्रतिनिधित्व मूल्य का होता है और एक uleb128
के रूप में एन्कोड किया जाता है। यह -1
की एन्कोडिंग बनाता है (वैकल्पिक रूप से अहस्ताक्षरित मान 0xffffffff
के रूप में सोचा जाता है) - लेकिन कोई अन्य ऋणात्मक संख्या नहीं - एक एकल बाइट, और उन मामलों में उपयोगी है जहां प्रतिनिधित्व संख्या या तो गैर-ऋणात्मक या -1
(या 0xffffffff
), और जहां कोई अन्य नकारात्मक मूल्यों की अनुमति नहीं है (या जहां बड़े अहस्ताक्षरित मूल्यों की आवश्यकता होने की संभावना नहीं है)।
यहाँ स्वरूपों के कुछ उदाहरण दिए गए हैं:
एन्कोडेड अनुक्रम | sleb128 . के रूप में | uleb128 . के रूप में | uleb128p1 . के रूप में |
---|---|---|---|
00 | 0 | 0 | -1 |
01 | 1 | 1 | 0 |
7f | -1 | 127 | 126 |
80 7f | -128 | 16256 | 16255 |
फ़ाइल लेआउट
नाम | प्रारूप | विवरण |
---|---|---|
हैडर | हेडर_आइटम | शीर्षलेख |
string_ids | string_id_item[] | स्ट्रिंग पहचानकर्ता सूची। ये इस फ़ाइल द्वारा उपयोग किए गए सभी स्ट्रिंग्स के लिए पहचानकर्ता हैं, या तो आंतरिक नामकरण के लिए (उदाहरण के लिए, डिस्क्रिप्टर टाइप करें) या कोड द्वारा संदर्भित निरंतर ऑब्जेक्ट के रूप में। इस सूची को स्ट्रिंग सामग्री द्वारा क्रमबद्ध किया जाना चाहिए, UTF-16 कोड बिंदु मान (स्थानीय-संवेदनशील तरीके से नहीं) का उपयोग करके, और इसमें कोई डुप्लिकेट प्रविष्टियाँ नहीं होनी चाहिए। |
type_ids | type_id_item[] | पहचानकर्ता सूची टाइप करें। ये इस फ़ाइल द्वारा संदर्भित सभी प्रकार (वर्ग, सरणियाँ, या आदिम प्रकार) के लिए पहचानकर्ता हैं, चाहे फ़ाइल में परिभाषित किया गया हो या नहीं। इस सूची को string_id अनुक्रमणिका द्वारा क्रमबद्ध किया जाना चाहिए, और इसमें कोई डुप्लिकेट प्रविष्टियां नहीं होनी चाहिए। |
प्रोटो_आईड्स | proto_id_item[] | विधि प्रोटोटाइप पहचानकर्ता सूची। ये इस फ़ाइल द्वारा संदर्भित सभी प्रोटोटाइप के लिए पहचानकर्ता हैं। इस सूची को रिटर्न-टाइप ( type_id इंडेक्स द्वारा) प्रमुख क्रम में क्रमबद्ध किया जाना चाहिए, और फिर तर्क सूची (लेक्सिकोग्राफिक ऑर्डरिंग, type_id इंडेक्स द्वारा आदेशित व्यक्तिगत तर्क) द्वारा क्रमबद्ध किया जाना चाहिए। सूची में कोई डुप्लीकेट प्रविष्टियां नहीं होनी चाहिए। |
फ़ील्ड_आईडी | field_id_item[] | फ़ील्ड पहचानकर्ता सूची। ये इस फ़ाइल द्वारा निर्दिष्ट सभी फ़ील्ड के लिए पहचानकर्ता हैं, चाहे फ़ाइल में परिभाषित किया गया हो या नहीं। इस सूची को क्रमबद्ध किया जाना चाहिए, जहां परिभाषित प्रकार ( type_id अनुक्रमणिका द्वारा) प्रमुख क्रम है, फ़ील्ड नाम ( string_id अनुक्रमणिका द्वारा) मध्यवर्ती क्रम है, और प्रकार ( type_id अनुक्रमणिका द्वारा) मामूली क्रम है। सूची में कोई डुप्लीकेट प्रविष्टियां नहीं होनी चाहिए। |
method_ids | method_id_item[] | विधि पहचानकर्ता सूची। ये इस फ़ाइल द्वारा संदर्भित सभी विधियों के लिए पहचानकर्ता हैं, चाहे फ़ाइल में परिभाषित किया गया हो या नहीं। इस सूची को क्रमबद्ध किया जाना चाहिए, जहां परिभाषित प्रकार ( type_id अनुक्रमणिका द्वारा) प्रमुख क्रम है, विधि का नाम ( string_id अनुक्रमणिका द्वारा) मध्यवर्ती क्रम है, और विधि प्रोटोटाइप ( proto_id अनुक्रमणिका द्वारा) मामूली क्रम है। सूची में कोई डुप्लीकेट प्रविष्टियां नहीं होनी चाहिए। |
class_defs | class_def_item[] | वर्ग परिभाषा सूची। कक्षाओं को इस तरह से आदेश दिया जाना चाहिए कि किसी दिए गए वर्ग के सुपरक्लास और कार्यान्वित इंटरफेस रेफरिंग क्लास से पहले सूची में दिखाई दें। इसके अलावा, एक ही नाम वाले वर्ग की परिभाषा के लिए सूची में एक से अधिक बार प्रकट होना अमान्य है। |
call_site_ids | call_site_id_item[] | कॉल साइट पहचानकर्ता सूची। ये इस फ़ाइल द्वारा संदर्भित सभी कॉल साइटों के लिए पहचानकर्ता हैं, चाहे फ़ाइल में परिभाषित किया गया हो या नहीं। इस सूची को call_site_off के आरोही क्रम में क्रमबद्ध किया जाना चाहिए। |
मेथड_हैंडल्स | method_handle_item [] | विधि हैंडल सूची। इस फ़ाइल द्वारा संदर्भित सभी विधि हैंडल की एक सूची, चाहे फ़ाइल में परिभाषित हो या नहीं। इस सूची को क्रमबद्ध नहीं किया गया है और इसमें डुप्लीकेट हो सकते हैं जो तार्किक रूप से विभिन्न मेथड हैंडल इंस्टेंस के अनुरूप होंगे। |
जानकारी | यूबाइट [] | डेटा क्षेत्र, जिसमें ऊपर सूचीबद्ध तालिकाओं के लिए सभी समर्थन डेटा शामिल हैं। अलग-अलग मदों में अलग-अलग संरेखण आवश्यकताएं होती हैं, और उचित संरेखण प्राप्त करने के लिए यदि आवश्यक हो तो प्रत्येक आइटम से पहले पैडिंग बाइट्स डाले जाते हैं। |
लिंक_डेटा | यूबाइट [] | सांख्यिकीय रूप से लिंक की गई फ़ाइलों में उपयोग किया जाने वाला डेटा। इस खंड में डेटा का प्रारूप इस दस्तावेज़ द्वारा अनिर्दिष्ट छोड़ दिया गया है। यह खंड अनलिंक की गई फ़ाइलों में खाली है, और रनटाइम कार्यान्वयन इसका उपयोग कर सकते हैं जैसा कि वे फिट देखते हैं। |
बिटफ़ील्ड, स्ट्रिंग और निरंतर परिभाषाएँ
DEX_FILE_MAGIC
हेडर_आइटम में एम्बेड किया गया
स्थिर सरणी/स्ट्रिंग DEX_FILE_MAGIC
बाइट्स की सूची है जो एक .dex
फ़ाइल की शुरुआत में दिखाई देनी चाहिए ताकि इसे इस तरह पहचाना जा सके। भ्रष्टाचार के कुछ रूपों का पता लगाने में मदद करने के लिए मान में जानबूझकर एक नई लाइन ( "\n"
या 0x0a
) और एक नल बाइट ( "\0"
या 0x00
) शामिल है। मान एक प्रारूप संस्करण संख्या को तीन दशमलव अंकों के रूप में भी एन्कोड करता है, जो प्रारूप के विकसित होने के साथ-साथ समय के साथ नीरस रूप से बढ़ने की उम्मीद है।
ubyte[8] DEX_FILE_MAGIC = { 0x64 0x65 0x78 0x0a 0x30 0x33 0x39 0x00 } = "dex\n039\0"
नोट: प्रारूप के संस्करण 039
के लिए समर्थन एंड्रॉइड 9.0 रिलीज में जोड़ा गया था, जिसने दो नए बाइटकोड, const-method-handle
और const-method-type
पेश किए। (ये प्रत्येक बायटेकोड सेट टेबल के सारांश में वर्णित हैं।) एंड्रॉइड 10 में, संस्करण 039
छिपी हुई एपीआई जानकारी को शामिल करने के लिए डीईएक्स फ़ाइल प्रारूप का विस्तार करता है जो केवल बूट क्लास पथ पर डीईएक्स फाइलों पर लागू होता है।
नोट: प्रारूप के संस्करण 038
के लिए समर्थन Android 8.0 रिलीज में जोड़ा गया था। संस्करण 038
ने नए बाइटकोड ( invoke-polymorphic
और invoke-custom
) और मेथड हैंडल के लिए डेटा जोड़ा।
नोट: प्रारूप के संस्करण 037
के लिए समर्थन Android 7.0 रिलीज में जोड़ा गया था। संस्करण 037
से पहले एंड्रॉइड के अधिकांश संस्करणों ने प्रारूप के संस्करण 035
का उपयोग किया है। संस्करण 035
और 037
के बीच एकमात्र अंतर डिफ़ॉल्ट विधियों को जोड़ने और invoke
के समायोजन का है।
नोट: व्यापक रूप से उपलब्ध सार्वजनिक सॉफ़्टवेयर रिलीज़ में प्रारूप के कम से कम कुछ पुराने संस्करणों का उपयोग किया गया है। उदाहरण के लिए, संस्करण 009
का उपयोग Android प्लेटफ़ॉर्म के M3 रिलीज़ (नवंबर-दिसंबर 2007) के लिए किया गया था, और संस्करण 013
का उपयोग Android प्लेटफ़ॉर्म (फरवरी-मार्च 2008) के M5 रिलीज़ के लिए किया गया था। कई मायनों में, प्रारूप के ये पुराने संस्करण इस दस्तावेज़ में वर्णित संस्करण से महत्वपूर्ण रूप से भिन्न हैं।
ENDIAN_CONSTANT और REVERSE_ENDIAN_CONSTANT
हेडर_आइटम में एम्बेड किया गया
स्थिर ENDIAN_CONSTANT
का उपयोग उस फ़ाइल की अंतहीनता को इंगित करने के लिए किया जाता है जिसमें वह पाई जाती है। हालांकि मानक .dex
प्रारूप थोड़ा-एंडियन है, कार्यान्वयन बाइट-स्वैपिंग करना चुन सकते हैं। यदि कार्यान्वयन एक ऐसे शीर्षलेख पर आता है जिसका endian_tag
REVERSE_ENDIAN_CONSTANT
के बजाय ENDIAN_CONSTANT
है, तो यह जान जाएगा कि फ़ाइल को अपेक्षित रूप से बाइट-स्वैप किया गया है।
uint ENDIAN_CONSTANT = 0x12345678; uint REVERSE_ENDIAN_CONSTANT = 0x78563412;
NO_INDEX
class_def_item और debug_info_item में एम्बेडेड है
निरंतर NO_INDEX
का उपयोग यह इंगित करने के लिए किया जाता है कि कोई अनुक्रमणिका मान अनुपस्थित है।
नोट: यह मान 0
के रूप में परिभाषित नहीं है, क्योंकि यह वास्तव में एक मान्य अनुक्रमणिका है।
NO_INDEX
के लिए चुना गया मान uleb128p1
एन्कोडिंग में एकल बाइट के रूप में प्रदर्शित करने योग्य है।
uint NO_INDEX = 0xffffffff; // == -1 if treated as a signed int
access_flags परिभाषाएं
class_def_item, एन्कोडेड_फ़ील्ड, एन्कोडेड_मेथोड और इनरक्लास में एम्बेड किया गया है
इन झंडों के बिटफ़ील्ड का उपयोग कक्षाओं और वर्ग के सदस्यों की पहुँच और समग्र गुणों को इंगित करने के लिए किया जाता है।
नाम | मूल्य | कक्षाओं के लिए (और InnerClass एनोटेशन) | फ़ील्ड के लिए | विधियों के लिए |
---|---|---|---|---|
एसीसी_सार्वजनिक | 0x1 | public : हर जगह दिखाई देने वाला | public : हर जगह दिखाई देने वाला | public : हर जगह दिखाई देने वाला |
एसीसी_निजी | 0x2 | private : केवल परिभाषित वर्ग के लिए दृश्यमान | private : केवल परिभाषित वर्ग के लिए दृश्यमान | private : केवल परिभाषित वर्ग के लिए दृश्यमान |
ACC_PROTECTED | 0x4 | protected : पैकेज और उपवर्गों के लिए दृश्यमान | protected : पैकेज और उपवर्गों के लिए दृश्यमान | protected : पैकेज और उपवर्गों के लिए दृश्यमान |
ACC_STATIC | 0x8 | static : this संदर्भ के बाहरी के साथ निर्मित नहीं है | static : वैश्विक से परिभाषित वर्ग | static : this तर्क नहीं लेता |
ACC_FINAL | 0x10 | final : उपवर्गीय नहीं | final : निर्माण के बाद अपरिवर्तनीय | final : अतिश्योक्तिपूर्ण नहीं |
ACC_SYNCHRONIZED | 0x20 | synchronized : संबंधित लॉक स्वचालित रूप से इस विधि के लिए कॉल के आसपास प्राप्त किया जाता है। नोट: यह केवल तभी मान्य है जब | ||
ACC_VOLATILE | 0x40 | volatile : थ्रेड सुरक्षा में सहायता के लिए विशेष एक्सेस नियम | ||
ACC_BRIDGE | 0x40 | ब्रिज विधि, कंपाइलर द्वारा स्वचालित रूप से टाइप-सेफ ब्रिज के रूप में जोड़ी जाती है | ||
ACC_TRANSIENT | 0x80 | transient : डिफ़ॉल्ट क्रमांकन द्वारा सहेजा नहीं जाना चाहिए | ||
ACC_VARARGS | 0x80 | अंतिम तर्क को संकलक द्वारा "आराम" तर्क के रूप में माना जाना चाहिए | ||
ACC_NATIVE | 0x100 | native : देशी कोड में लागू किया गया | ||
ACC_INTERFACE | 0x200 | interface : बहु-कार्यान्वयन योग्य सार वर्ग | ||
ACC_ABSTRACT | 0x400 | abstract : सीधे तात्कालिक नहीं | abstract : इस वर्ग द्वारा लागू नहीं किया गया | |
ACC_STRICT | 0x800 | सख्त strictfp : फ्लोटिंग-पॉइंट अंकगणित के लिए सख्त नियम | ||
ACC_SYNTHETIC | 0x1000 | स्रोत कोड में सीधे परिभाषित नहीं है | स्रोत कोड में सीधे परिभाषित नहीं है | स्रोत कोड में सीधे परिभाषित नहीं है |
ACC_ANNOTATION | 0x2000 | एक एनोटेशन वर्ग के रूप में घोषित किया गया | ||
ACC_ENUM | 0x4000 | एक प्रगणित प्रकार के रूप में घोषित किया गया | एक गणना मूल्य के रूप में घोषित | |
(अप्रयुक्त) | 0x8000 | |||
ACC_CONSTRUCTOR | 0x10000 | कंस्ट्रक्टर विधि (वर्ग या उदाहरण प्रारंभकर्ता) | ||
एसीसी_DECLARED_ सिंक्रनाइज़ | 0x20000 | synchronized घोषित किया गया।नोट: इसका निष्पादन पर कोई प्रभाव नहीं पड़ता है (इस ध्वज के प्रतिबिंब के अलावा, प्रति से)। |
InnerClass
एनोटेशन के लिए अनुमति है, और कभी भी class_def_item
में चालू नहीं होना चाहिए।
MUTF-8 (संशोधित UTF-8) एन्कोडिंग
आसान विरासत समर्थन के लिए एक रियायत के रूप में, .dex
प्रारूप अपने स्ट्रिंग डेटा को एक वास्तविक मानक संशोधित UTF-8 रूप में एन्कोड करता है, जिसे इसके बाद MUTF-8 के रूप में संदर्भित किया जाता है। यह फ़ॉर्म मानक UTF-8 के समान है, सिवाय:
- केवल एक-, दो- और तीन-बाइट एन्कोडिंग का उपयोग किया जाता है।
-
U+10000
…U+10ffff
श्रेणी में कोड बिंदु एक सरोगेट जोड़ी के रूप में एन्कोड किए गए हैं, जिनमें से प्रत्येक को तीन-बाइट एन्कोडेड मान के रूप में दर्शाया गया है। - कोड बिंदु
U+0000
दो-बाइट रूप में एन्कोड किया गया है। - एक सादा नल बाइट (मान
0
) एक स्ट्रिंग के अंत को इंगित करता है, जैसा कि मानक सी भाषा व्याख्या है।
उपरोक्त पहले दो मदों को संक्षेप में प्रस्तुत किया जा सकता है: एमयूटीएफ -8 यूटीएफ -16 के लिए एक एन्कोडिंग प्रारूप है, बजाय यूनिकोड वर्णों के लिए अधिक प्रत्यक्ष एन्कोडिंग प्रारूप होने के।
उपरोक्त अंतिम दो आइटम एक साथ कोड बिंदु U+0000
को एक स्ट्रिंग में शामिल करना संभव बनाते हैं और फिर भी इसे C-स्टाइल नल-टर्मिनेटेड स्ट्रिंग के रूप में हेरफेर करते हैं।
हालांकि, U+0000
+0000 के विशेष एन्कोडिंग का मतलब है कि, सामान्य यूटीएफ -8 के विपरीत, एमयूटीएफ -8 तारों की एक जोड़ी पर मानक सी फ़ंक्शन strcmp()
को कॉल करने का नतीजा हमेशा असमान तारों की तुलना के उचित हस्ताक्षरित परिणाम को इंगित नहीं करता है . जब ऑर्डर करना (सिर्फ समानता नहीं) एक चिंता का विषय है, तो MUTF-8 स्ट्रिंग्स की तुलना करने का सबसे सीधा तरीका है कि उन्हें कैरेक्टर द्वारा कैरेक्टर को डिकोड किया जाए, और डिकोडेड वैल्यूज की तुलना की जाए। (हालांकि, अधिक चतुर कार्यान्वयन भी संभव हैं।)
वर्ण एन्कोडिंग के बारे में अधिक जानकारी के लिए कृपया यूनिकोड मानक देखें। एमयूटीएफ -8 वास्तव में यूटीएफ -8 प्रति से की तुलना में सीईएसयू -8 एन्कोडिंग (अपेक्षाकृत कम प्रसिद्ध) एन्कोडिंग के करीब है।
एन्कोडेड_वैल्यू एन्कोडिंग
एनोटेशन_लेमेंट और एन्कोडेड_एरे_आइटम में एम्बेडेड
एक encoded_value
(लगभग) मनमाने ढंग से पदानुक्रमित संरचित डेटा का एक एन्कोडेड टुकड़ा है। एन्कोडिंग का मतलब पार्स करने के लिए कॉम्पैक्ट और सीधा दोनों होना है।
नाम | प्रारूप | विवरण |
---|---|---|
(value_arg << 5) | मान प्रकार | यूबाइट | बाइट उच्च-क्रम तीन बिट्स में एक वैकल्पिक स्पष्टीकरण तर्क के साथ तत्काल बाद के value के प्रकार को इंगित करता है। विभिन्न value परिभाषाओं के लिए नीचे देखें। ज्यादातर मामलों में, value_arg बाइट्स में तत्काल-बाद के value की लंबाई को एन्कोड करता है, जैसे (size - 1) , उदाहरण के लिए, 0 का अर्थ है कि मान को एक बाइट की आवश्यकता होती है, और 7 का अर्थ है कि इसके लिए आठ बाइट्स की आवश्यकता होती है; हालाँकि, अपवाद हैं जैसा कि नीचे बताया गया है। |
मूल्य | यूबाइट [] | मूल्य का प्रतिनिधित्व करने वाले बाइट्स, लंबाई में परिवर्तनशील और अलग-अलग value_type बाइट्स के लिए अलग-अलग व्याख्या करते हैं, हालांकि हमेशा छोटे-एंडियन होते हैं। विवरण के लिए नीचे दी गई विभिन्न मूल्य परिभाषाएं देखें। |
मूल्य प्रारूप
नाम टाइप करें | value_type | value_arg प्रारूप | value प्रारूप | विवरण |
---|---|---|---|---|
VALUE_BYTE | 0x00 | (कोई नहीं; 0 होना चाहिए) | यूबाइट[1] | हस्ताक्षरित एक-बाइट पूर्णांक मान |
VALUE_SHORT | 0x02 | आकार - 1 (0…1) | यूबाइट [आकार] | हस्ताक्षरित दो-बाइट पूर्णांक मान, साइन-विस्तारित |
VALUE_CHAR | 0x03 | आकार - 1 (0…1) | यूबाइट [आकार] | अहस्ताक्षरित दो-बाइट पूर्णांक मान, शून्य-विस्तारित |
VALUE_INT | 0x04 | आकार - 1 (0…3) | यूबाइट [आकार] | हस्ताक्षरित चार-बाइट पूर्णांक मान, साइन-विस्तारित |
VALUE_LONG | 0x06 | आकार - 1 (0… 7) | यूबाइट [आकार] | हस्ताक्षरित आठ-बाइट पूर्णांक मान, साइन-विस्तारित |
VALUE_FLOAT | 0x10 | आकार - 1 (0…3) | यूबाइट [आकार] | चार-बाइट बिट पैटर्न, शून्य-विस्तारित दाईं ओर , और IEEE754 32-बिट फ्लोटिंग पॉइंट मान के रूप में व्याख्या की गई |
VALUE_DOUBLE | 0x11 | आकार - 1 (0… 7) | यूबाइट [आकार] | आठ-बाइट बिट पैटर्न, शून्य-विस्तारित दाईं ओर , और IEEE754 64-बिट फ्लोटिंग पॉइंट मान के रूप में व्याख्या की गई |
VALUE_METHOD_TYPE | 0x15 | आकार - 1 (0…3) | यूबाइट [आकार] | अहस्ताक्षरित (शून्य-विस्तारित) चार-बाइट पूर्णांक मान, proto_ids अनुभाग में एक अनुक्रमणिका के रूप में व्याख्या किया गया और एक विधि प्रकार मान का प्रतिनिधित्व करता है |
VALUE_METHOD_HANDLE | 0x16 | आकार - 1 (0…3) | यूबाइट [आकार] | अहस्ताक्षरित (शून्य-विस्तारित) चार-बाइट पूर्णांक मान, method_handles सेक्शन में एक इंडेक्स के रूप में व्याख्या किया गया और एक मेथड हैंडल वैल्यू का प्रतिनिधित्व करता है |
VALUE_STRING | 0x17 | आकार - 1 (0…3) | यूबाइट [आकार] | अहस्ताक्षरित (शून्य-विस्तारित) चार-बाइट पूर्णांक मान, string_ids अनुभाग में एक अनुक्रमणिका के रूप में व्याख्या किया गया और एक स्ट्रिंग मान का प्रतिनिधित्व करता है |
मान प्रकार | 0x18 | आकार - 1 (0…3) | यूबाइट [आकार] | अहस्ताक्षरित (शून्य-विस्तारित) चार-बाइट पूर्णांक मान, जिसे type_ids अनुभाग में एक अनुक्रमणिका के रूप में व्याख्या किया गया है और एक प्रतिबिंबित प्रकार/वर्ग मान का प्रतिनिधित्व करता है |
VALUE_FIELD | 0x19 | आकार - 1 (0…3) | यूबाइट [आकार] | अहस्ताक्षरित (शून्य-विस्तारित) चार-बाइट पूर्णांक मान, जिसे field_ids अनुभाग में एक अनुक्रमणिका के रूप में व्याख्या किया गया है और एक परावर्तक फ़ील्ड मान का प्रतिनिधित्व करता है |
VALUE_METHOD | 0x1a | आकार - 1 (0…3) | यूबाइट [आकार] | अहस्ताक्षरित (शून्य-विस्तारित) चार-बाइट पूर्णांक मान, जिसे method_ids अनुभाग में एक अनुक्रमणिका के रूप में व्याख्या किया गया है और एक परावर्तक विधि मान का प्रतिनिधित्व करता है |
VALUE_ENUM | 0x1b | आकार - 1 (0…3) | यूबाइट [आकार] | अहस्ताक्षरित (शून्य-विस्तारित) चार-बाइट पूर्णांक मान, जिसे field_ids अनुभाग में एक अनुक्रमणिका के रूप में व्याख्या किया गया है और एक प्रगणित प्रकार स्थिरांक के मान का प्रतिनिधित्व करता है |
VALUE_ARRAY | 0x1c | (कोई नहीं; 0 होना चाहिए) | एन्कोडेड_एरे | नीचे दिए गए " encoded_array स्वरूप" द्वारा निर्दिष्ट प्रारूप में मानों की एक सरणी। value का आकार एन्कोडिंग में निहित है। |
VALUE_ANNOTATION | 0x1d | (कोई नहीं; 0 होना चाहिए) | एन्कोडेड_नोटेशन | एक उप-एनोटेशन, नीचे " encoded_annotation format" द्वारा निर्दिष्ट प्रारूप में। value का आकार एन्कोडिंग में निहित है। |
VALUE_NULL | 0x1e | (कोई नहीं; 0 होना चाहिए) | (कोई भी नहीं) | null संदर्भ मान |
VALUE_BOOLEAN | 0x1f | बूलियन (0…1) | (कोई भी नहीं) | एक-बिट मान; 0 false के लिए और 1 true के लिए। बिट को value_arg में दर्शाया गया है। |
एन्कोडेड_एरे प्रारूप
नाम | प्रारूप | विवरण |
---|---|---|
आकार | यूलेब128 | सरणी में तत्वों की संख्या |
मूल्यों | एन्कोडेड_वैल्यू [आकार] | इस खंड द्वारा निर्दिष्ट प्रारूप में encoded_value बाइट size की एक श्रृंखला, क्रमिक रूप से संयोजित। |
एन्कोडेड_नोटेशन प्रारूप
नाम | प्रारूप | विवरण |
---|---|---|
type_idx | यूलेब128 | एनोटेशन का प्रकार। यह एक वर्ग (सरणी या आदिम नहीं) प्रकार होना चाहिए। |
आकार | यूलेब128 | इस एनोटेशन में नाम-मूल्य मैपिंग की संख्या |
तत्वों | एनोटेशन_तत्व [आकार] | एनोटेशन के तत्व, सीधे इन-लाइन (ऑफ़सेट के रूप में नहीं) का प्रतिनिधित्व करते हैं। तत्वों को string_id अनुक्रमणिका द्वारा बढ़ते क्रम में क्रमबद्ध किया जाना चाहिए। |
एनोटेशन_तत्व प्रारूप
नाम | प्रारूप | विवरण |
---|---|---|
name_idx | यूलेब128 | तत्व का नाम, string_ids अनुभाग में एक अनुक्रमणिका के रूप में दर्शाया गया है। स्ट्रिंग को ऊपर परिभाषित MemberName के सिंटैक्स के अनुरूप होना चाहिए। |
मूल्य | एन्कोडेड_वैल्यू | तत्व मूल्य |
स्ट्रिंग सिंटैक्स
.dex
फ़ाइल में कई प्रकार के आइटम होते हैं जो अंततः एक स्ट्रिंग को संदर्भित करते हैं। निम्नलिखित बीएनएफ-शैली परिभाषाएं इन तारों के लिए स्वीकार्य वाक्यविन्यास दर्शाती हैं।
सरल नाम
एक साधारण नाम अन्य चीजों के नामों के वाक्य-विन्यास का आधार है। .dex
प्रारूप यहाँ अक्षांश की उचित मात्रा की अनुमति देता है (अधिकांश सामान्य स्रोत भाषाओं की तुलना में बहुत अधिक)। संक्षेप में, एक साधारण नाम में कोई भी निम्न-ASCII वर्ण या अंक, कुछ विशिष्ट निम्न-ASCII प्रतीक, और अधिकांश गैर-ASCII कोड बिंदु होते हैं जो नियंत्रण, स्थान या विशेष वर्ण नहीं होते हैं। संस्करण 040
से शुरू होकर प्रारूप अतिरिक्त रूप से अंतरिक्ष वर्णों (यूनिकोड Zs
श्रेणी) की अनुमति देता है। ध्यान दें कि सरोगेट कोड बिंदु (श्रेणी में U+d800 … U+dfff
U+d800
) को वैध नाम वर्ण नहीं माना जाता है, लेकिन यूनिकोड पूरक वर्ण मान्य हैं (जो SimpleNameChar के लिए नियम के अंतिम विकल्प द्वारा दर्शाए गए हैं), और वे MUTF-8 एन्कोडिंग में सरोगेट कोड बिंदुओं के जोड़े के रूप में एक फ़ाइल में प्रतिनिधित्व किया जाना चाहिए।
सरल नाम → | ||
SimpleNameChar ( SimpleNameChar )* | ||
SimpleNameChar → | ||
'A' ... 'Z' | ||
| | 'a' ... 'z' | |
| | '0' ... '9' | |
| | ' ' | DEX संस्करण 040 . के बाद से |
| | '$' | |
| | '-' | |
| | '_' | |
| | U+00a0 | DEX संस्करण 040 . के बाद से |
| | U+00a1 … U+1fff | |
| | U+2000 … U+200a | DEX संस्करण 040 . के बाद से |
| | U+2010 +2010 … U+2027 | |
| | U+202f | DEX संस्करण 040 . के बाद से |
| | U+2030 U+d7ff | |
| | U+e000 … U+ffef | |
| | U+10000 … U+10ffff |
सदस्य का नाम
field_id_item और method_id_item द्वारा उपयोग किया जाता है
एक सदस्य नाम एक वर्ग के सदस्य का नाम है, सदस्य क्षेत्र, विधियां और आंतरिक वर्ग हैं।
सदस्य का नाम → | |
सरल नाम | |
| | '<' सरल नाम '>' |
फुलक्लासनाम
एक FullClassName एक पूरी तरह से योग्य वर्ग का नाम है, जिसमें एक वैकल्पिक पैकेज विनिर्देशक के बाद एक आवश्यक नाम शामिल है।
फुलक्लासनाम → | |
वैकल्पिक पैकेजउपसर्ग सरलनाम | |
वैकल्पिक पैकेज उपसर्ग → | |
( सरलनाम '/' )* |
टाइप डिस्क्रिप्टर
type_id_item . द्वारा उपयोग किया जाता है
टाइपडिस्क्रिप्टर किसी भी प्रकार का प्रतिनिधित्व है, जिसमें आदिम, वर्ग, सरणियाँ और void
शामिल हैं। विभिन्न संस्करणों के अर्थ के लिए नीचे देखें।
टाइप डिस्क्रिप्टर → | |
'V' | |
| | फील्ड टाइप डिस्क्रिप्टर |
फील्ड टाइप डिस्क्रिप्टर → | |
NonArrayFieldTypeDescriptor | |
| | ( '[' * 1…255) NonArrayFieldTypeDescriptor |
NonArrayFieldTypeDescriptor → | |
'Z' | |
| | 'B' |
| | 'S' |
| | 'C' |
| | 'I' |
| | 'J' |
| | 'F' |
| | 'D' |
| | 'L' फुलक्लासनाम ';' |
छोटू वर्णनकर्ता
proto_id_item . द्वारा उपयोग किया जाता है
शॉर्टी डिस्क्रिप्टर एक विधि प्रोटोटाइप का संक्षिप्त रूप प्रतिनिधित्व है, जिसमें रिटर्न और पैरामीटर प्रकार शामिल हैं, सिवाय इसके कि विभिन्न संदर्भ (वर्ग या सरणी) प्रकारों के बीच कोई अंतर नहीं है। इसके बजाय, सभी संदर्भ प्रकारों को एकल 'L'
वर्ण द्वारा दर्शाया जाता है।
छोटू डिस्क्रिप्टर → | |
शॉर्टीरिटर्न टाइप ( शॉर्टीफिल्ड टाइप )* | |
शॉर्टीरिटर्न टाइप → | |
'V' | |
| | शॉर्टीफील्ड टाइप |
शॉर्टीफिल्ड टाइप → | |
'Z' | |
| | 'B' |
| | 'S' |
| | 'C' |
| | 'I' |
| | 'J' |
| | 'F' |
| | 'D' |
| | 'L' |
टाइप डिस्क्रिप्टर शब्दार्थ
यह TypeDescriptor के प्रत्येक प्रकार का अर्थ है।
वाक्य - विन्यास | अर्थ |
---|---|
वी | void ; केवल वापसी प्रकारों के लिए मान्य |
जेड | boolean |
बी | byte |
एस | short |
सी | char |
मैं | int |
जे | long |
एफ | float |
डी | double |
एल पूरी तरह से/योग्य/नाम ; | कक्षा पूरी तरह से fully.qualified.Name |
[ विवरणकर्ता | descriptor की सरणी, सरणियों के सरणियों के लिए पुनरावर्ती रूप से प्रयोग करने योग्य, हालांकि यह 255 से अधिक आयामों के लिए अमान्य है। |
आइटम और संबंधित संरचनाएं
इस खंड में प्रत्येक शीर्ष-स्तरीय आइटम के लिए परिभाषाएं शामिल हैं जो एक .dex
फ़ाइल में प्रकट हो सकती हैं।
हेडर_आइटम
शीर्ष लेख अनुभाग में दिखाई देता है
संरेखण: 4 बाइट्स
नाम | प्रारूप | विवरण |
---|---|---|
जादू | यूबाइट [8] = DEX_FILE_MAGIC | जादू मूल्य। अधिक विवरण के लिए " DEX_FILE_MAGIC " के अंतर्गत ऊपर चर्चा देखें। |
अंततः, | यूंट | शेष फ़ाइल का adler32 चेकसम ( magic और इस क्षेत्र के अलावा सब कुछ); फ़ाइल भ्रष्टाचार का पता लगाने के लिए प्रयोग किया जाता है |
हस्ताक्षर | यूबाइट [20] | शेष फ़ाइल का SHA-1 हस्ताक्षर (हैश) ( magic , checksum और इस क्षेत्र को छोड़कर सब कुछ); फ़ाइलों को विशिष्ट रूप से पहचानने के लिए उपयोग किया जाता है |
फाइल का आकार | यूंट | संपूर्ण फ़ाइल का आकार (शीर्षलेख सहित), बाइट्स में |
हेडर_साइज़ | यूंट = 0x70 | हेडर का आकार (यह पूरा खंड), बाइट्स में। यह प्रारूप को अमान्य किए बिना कम से कम सीमित मात्रा में पश्च/आगे संगतता की अनुमति देता है। |
एंडियन_टैग | यूइंट = ENDIAN_CONSTANT | अंतहीनता टैग। अधिक विवरण के लिए ऊपर " ENDIAN_CONSTANT और REVERSE_ENDIAN_CONSTANT " के अंतर्गत चर्चा देखें। |
link_size | यूंट | लिंक अनुभाग का आकार, या 0 यदि यह फ़ाइल स्थिर रूप से लिंक नहीं है |
लिंक_ऑफ | यूंट | फ़ाइल के प्रारंभ से लिंक अनुभाग में ऑफ़सेट करें, या 0 यदि link_size == 0 । ऑफ़सेट, यदि शून्य नहीं है, तो link_data अनुभाग में ऑफ़सेट होना चाहिए। इंगित किए गए डेटा का प्रारूप इस दस्तावेज़ द्वारा अनिर्दिष्ट छोड़ दिया गया है; यह हेडर फ़ील्ड (और पिछला) रनटाइम कार्यान्वयन द्वारा उपयोग के लिए हुक के रूप में छोड़ दिया जाता है। |
map_off | यूंट | फ़ाइल की शुरुआत से मानचित्र आइटम पर ऑफ़सेट करें। ऑफ़सेट, जो गैर-शून्य होना चाहिए, data अनुभाग में ऑफ़सेट होना चाहिए, और डेटा नीचे " map_list " द्वारा निर्दिष्ट प्रारूप में होना चाहिए। |
string_ids_size | यूंट | स्ट्रिंग आइडेंटिफ़ायर सूची में स्ट्रिंग्स की संख्या |
string_ids_off | यूंट | फ़ाइल की शुरुआत से स्ट्रिंग आइडेंटिफ़ायर सूची में ऑफ़सेट करें, या 0 यदि string_ids_size == 0 (बेशक एक अजीब किनारे का मामला)। ऑफ़सेट, यदि शून्य नहीं है, तो string_ids अनुभाग की शुरुआत में होना चाहिए। |
type_ids_size | यूंट | प्रकार पहचानकर्ता सूची में तत्वों की संख्या, अधिकतम 65535 |
type_ids_off | यूंट | फ़ाइल की शुरुआत से टाइप आइडेंटिफ़ायर सूची में ऑफ़सेट करें, या 0 यदि type_ids_size == 0 (बेशक एक अजीब किनारे का मामला)। ऑफ़सेट, यदि शून्य नहीं है, तो type_ids अनुभाग की शुरुआत में होना चाहिए। |
proto_ids_size | यूंट | प्रोटोटाइप पहचानकर्ताओं की सूची में तत्वों की संख्या, अधिकतम 65535 |
proto_ids_off | यूंट | फ़ाइल की शुरुआत से प्रोटोटाइप पहचानकर्ताओं की सूची में ऑफसेट, या 0 अगर proto_ids_size == 0 (बेशक एक अजीब किनारे का मामला)। ऑफ़सेट, अगर शून्य नहीं है, तो proto_ids सेक्शन की शुरुआत में होना चाहिए। |
field_ids_size | यूंट | क्षेत्र पहचानकर्ता सूची में तत्वों की संख्या |
field_ids_off | यूंट | फ़ाइल की शुरुआत से फ़ील्ड पहचानकर्ता सूची में ऑफ़सेट करें, या 0 if field_ids_size == 0 । ऑफ़सेट, यदि शून्य नहीं है, तो field_ids अनुभाग के प्रारंभ में होना चाहिए। |
method_ids_size | यूंट | विधि पहचानकर्ता सूची में तत्वों की संख्या |
method_ids_off | यूंट | फ़ाइल की शुरुआत से विधि पहचानकर्ता सूची में ऑफसेट, या 0 if method_ids_size == 0 । ऑफ़सेट, यदि शून्य नहीं है, तो method_ids अनुभाग की शुरुआत में होना चाहिए। |
class_defs_size | यूंट | वर्ग परिभाषा सूची में तत्वों की संख्या |
class_defs_off | यूंट | फ़ाइल की शुरुआत से वर्ग परिभाषा सूची में ऑफसेट, या 0 अगर class_defs_size == 0 (बेशक एक अजीब बढ़त मामला)। ऑफ़सेट, यदि शून्य नहीं है, class_defs अनुभाग के प्रारंभ में होना चाहिए। |
डेटा_साइज़ | यूंट | बाइट्स में data सेक्शन का आकार। sizeof(uint) का सम गुणक होना चाहिए। |
data_off | यूंट | फ़ाइल की शुरुआत से data अनुभाग की शुरुआत तक ऑफसेट। |
नक्शा_सूची
डेटा अनुभाग में दिखाई देता है
Header_item . से संदर्भित
संरेखण: 4 बाइट्स
यह क्रम में एक फ़ाइल की संपूर्ण सामग्री की एक सूची है। इसमें header_item
के संबंध में कुछ अतिरेक शामिल हैं, लेकिन इसका उद्देश्य संपूर्ण फ़ाइल पर पुनरावृति करने के लिए उपयोग करने के लिए एक आसान रूप है। किसी दिए गए प्रकार को मानचित्र में अधिक से अधिक एक बार प्रकट होना चाहिए, लेकिन इस पर कोई प्रतिबंध नहीं है कि किस प्रकार के क्रम में प्रदर्शित हो सकता है, बाकी प्रारूप द्वारा निहित प्रतिबंधों के अलावा (उदाहरण के लिए, एक header
अनुभाग पहले दिखाई देना चाहिए, उसके बाद string_ids
अनुभाग, आदि)। इसके अतिरिक्त, मानचित्र प्रविष्टियों को प्रारंभिक ऑफ़सेट द्वारा क्रमित किया जाना चाहिए और ओवरलैप नहीं होना चाहिए।
नाम | प्रारूप | विवरण |
---|---|---|
आकार | यूंट | सूची का आकार, प्रविष्टियों में |
सूची | map_item [आकार] | सूची के तत्व |
map_item प्रारूप
नाम | प्रारूप | विवरण |
---|---|---|
प्रकार | उशॉर्ट | वस्तुओं का प्रकार; नीचे दी गई तालिका देखें |
अप्रयुक्त | उशॉर्ट | (अप्रयुक्त) |
आकार | यूंट | संकेतित ऑफसेट पर मिलने वाली वस्तुओं की संख्या की गणना |
ओफ़्सेट | यूंट | फ़ाइल की शुरुआत से लेकर विचाराधीन आइटम तक ऑफ़सेट करें |
कोड टाइप करें
वस्तु परक | नियत | मूल्य | आइटम का आकार बाइट्स में |
---|---|---|---|
हेडर_आइटम | TYPE_HEADER_ITEM | 0x0000 | 0x70 |
string_id_item | TYPE_STRING_ID_ITEM | 0x0001 | 0x04 |
type_id_item | TYPE_TYPE_ID_ITEM | 0x0002 | 0x04 |
प्रोटो_आईडी_आइटम | TYPE_PROTO_ID_ITEM | 0x0003 | 0x0c |
field_id_item | TYPE_FIELD_ID_ITEM | 0x0004 | 0x08 |
method_id_item | TYPE_METHOD_ID_ITEM | 0x0005 | 0x08 |
class_def_item | TYPE_CLASS_DEF_ITEM | 0x0006 | 0x20 |
call_site_id_item | TYPE_CALL_SITE_ID_ITEM | 0x0007 | 0x04 |
method_handle_item | TYPE_METHOD_HANDLE_ITEM | 0x0008 | 0x08 |
नक्शा_सूची | TYPE_MAP_LIST | 0x1000 | 4+ (आइटम आकार * 12) |
टाइप_लिस्ट | TYPE_TYPE_LIST | 0x1001 | 4+ (आइटम आकार * 2) |
एनोटेशन_सेट_रेफ_लिस्ट | TYPE_ANNOTATION_SET_REF_LIST | 0x1002 | 4+ (आइटम आकार * 4) |
एनोटेशन_सेट_आइटम | TYPE_ANNOTATION_SET_ITEM | 0x1003 | 4+ (आइटम आकार * 4) |
class_data_item | TYPE_CLASS_DATA_ITEM | 0x2000 | अंतर्निहित; पार्स करना चाहिए |
code_item | TYPE_CODE_ITEM | 0x2001 | अंतर्निहित; पार्स करना चाहिए |
string_data_item | TYPE_STRING_DATA_ITEM | 0x2002 | अंतर्निहित; पार्स करना चाहिए |
डिबग_इन्फो_आइटम | TYPE_DEBUG_INFO_ITEM | 0x2003 | अंतर्निहित; पार्स करना चाहिए |
एनोटेशन_आइटम | TYPE_ANNOTATION_ITEM | 0x2004 | अंतर्निहित; पार्स करना चाहिए |
एन्कोडेड_एरे_आइटम | TYPE_ENCODED_ARRAY_ITEM | 0x2005 | अंतर्निहित; पार्स करना चाहिए |
एनोटेशन_निर्देशिका_आइटम | TYPE_ANNOTATIONS_DIRECTORY_ITEM | 0x2006 | अंतर्निहित; पार्स करना चाहिए |
Hideapi_class_data_item | TYPE_HIDDENAPI_CLASS_DATA_ITEM | 0xF000 | अंतर्निहित; पार्स करना चाहिए |
string_id_item
string_ids अनुभाग में दिखाई देता है
संरेखण: 4 बाइट्स
नाम | प्रारूप | विवरण |
---|---|---|
string_data_off | यूंट | इस आइटम के लिए फ़ाइल की शुरुआत से स्ट्रिंग डेटा तक ऑफ़सेट करें। ऑफ़सेट data अनुभाग में किसी स्थान पर होना चाहिए, और डेटा नीचे " string_data_item " द्वारा निर्दिष्ट प्रारूप में होना चाहिए। ऑफसेट के लिए कोई संरेखण आवश्यकता नहीं है। |
string_data_item
डेटा अनुभाग में दिखाई देता है
संरेखण: कोई नहीं (बाइट-संरेखित)
नाम | प्रारूप | विवरण |
---|---|---|
utf16_आकार | यूलेब128 | इस स्ट्रिंग का आकार, UTF-16 कोड इकाइयों में (जो कि कई प्रणालियों में "स्ट्रिंग लंबाई" है)। यही है, यह स्ट्रिंग की डीकोडेड लंबाई है। (एन्कोडेड लंबाई 0 बाइट की स्थिति से निहित है।) |
जानकारी | यूबाइट [] | MUTF-8 कोड इकाइयों (उर्फ ऑक्टेट, उर्फ बाइट्स) की एक श्रृंखला के बाद मान 0 का एक बाइट। डेटा प्रारूप के बारे में विवरण और चर्चा के लिए ऊपर "MUTF-8 (संशोधित UTF-8) एन्कोडिंग" देखें। नोट: एक स्ट्रिंग होना स्वीकार्य है जिसमें (एन्कोडेड रूप का) UTF-16 सरोगेट कोड यूनिट (अर्थात, |
type_id_item
type_ids अनुभाग में दिखाई देता है
संरेखण: 4 बाइट्स
नाम | प्रारूप | विवरण |
---|---|---|
डिस्क्रिप्टर_आईडीएक्स | यूंट | इस प्रकार के डिस्क्रिप्टर स्ट्रिंग के लिए string_ids सूची में अनुक्रमणिका। स्ट्रिंग को ऊपर परिभाषित TypeDescriptor के सिंटैक्स के अनुरूप होना चाहिए। |
प्रोटो_आईडी_आइटम
proto_ids अनुभाग में दिखाई देता है
संरेखण: 4 बाइट्स
नाम | प्रारूप | विवरण |
---|---|---|
छोटू_आईडीएक्स | यूंट | इस प्रोटोटाइप के शॉर्ट-फॉर्म डिस्क्रिप्टर स्ट्रिंग के लिए string_ids सूची में अनुक्रमणिका। स्ट्रिंग को ऊपर परिभाषित ShortyDescriptor के सिंटैक्स के अनुरूप होना चाहिए, और इस आइटम के रिटर्न प्रकार और मापदंडों के अनुरूप होना चाहिए। |
रिटर्न_टाइप_आईडीएक्स | यूंट | इस प्रोटोटाइप के रिटर्न प्रकार के लिए type_ids सूची में अनुक्रमणिका |
पैरामीटर_ऑफ | यूंट | फ़ाइल की शुरुआत से ऑफसेट इस प्रोटोटाइप के लिए पैरामीटर प्रकारों की सूची में, या 0 यदि इस प्रोटोटाइप में कोई पैरामीटर नहीं है। यह ऑफ़सेट, यदि शून्य नहीं है, data अनुभाग में होना चाहिए, और डेटा नीचे "type_list" द्वारा निर्दिष्ट प्रारूप में होना चाहिए। इसके अतिरिक्त, सूची में void प्रकार का कोई संदर्भ नहीं होना चाहिए। |
field_id_item
field_ids अनुभाग में दिखाई देता है
संरेखण: 4 बाइट्स
नाम | प्रारूप | विवरण |
---|---|---|
क्लास_आईडीएक्स | उशॉर्ट | इस क्षेत्र के निश्चितकर्ता के लिए type_ids सूची में अनुक्रमणिका। यह एक वर्ग प्रकार होना चाहिए, न कि एक सरणी या आदिम प्रकार। |
type_idx | उशॉर्ट | इस फ़ील्ड के प्रकार के लिए type_ids सूची में अनुक्रमणिका |
name_idx | यूंट | इस क्षेत्र के नाम के लिए string_ids सूची में अनुक्रमणिका। स्ट्रिंग को ऊपर परिभाषित MemberName के सिंटैक्स के अनुरूप होना चाहिए। |
method_id_item
method_ids अनुभाग में दिखाई देता है
संरेखण: 4 बाइट्स
नाम | प्रारूप | विवरण |
---|---|---|
क्लास_आईडीएक्स | उशॉर्ट | इस विधि के निश्चितकर्ता के लिए type_ids सूची में अनुक्रमणिका। यह एक वर्ग या सरणी प्रकार होना चाहिए, न कि एक आदिम प्रकार। |
प्रोटो_आईडीएक्स | उशॉर्ट | इस पद्धति के प्रोटोटाइप के लिए proto_ids सूची में अनुक्रमणिका |
name_idx | यूंट | इस विधि के नाम के लिए string_ids सूची में अनुक्रमणिका। स्ट्रिंग को ऊपर परिभाषित MemberName के सिंटैक्स के अनुरूप होना चाहिए। |
class_def_item
class_defs अनुभाग में दिखाई देता है
संरेखण: 4 बाइट्स
नाम | प्रारूप | विवरण |
---|---|---|
क्लास_आईडीएक्स | यूंट | इस वर्ग के लिए type_ids सूची में अनुक्रमणिका। यह एक वर्ग प्रकार होना चाहिए, न कि एक सरणी या आदिम प्रकार। |
access_flags | यूंट | वर्ग के लिए एक्सेस झंडे ( public , final , आदि)। विवरण के लिए " access_flags परिभाषाएँ" देखें। |
सुपरक्लास_आईडीएक्स | यूंट | सुपरक्लास के लिए type_ids सूची में अनुक्रमणिका, या स्थिर मान NO_INDEX यदि इस वर्ग में कोई सुपरक्लास नहीं है (यानी, यह एक रूट क्लास है जैसे Object )। यदि मौजूद है, तो यह एक वर्ग प्रकार होना चाहिए, न कि एक सरणी या आदिम प्रकार। |
इंटरफेस_ऑफ | यूंट | फ़ाइल की शुरुआत से इंटरफ़ेस की सूची में ऑफसेट, या 0 यदि कोई नहीं है। यह ऑफसेट data अनुभाग में होना चाहिए, और डेटा नीचे " type_list " द्वारा निर्दिष्ट प्रारूप में होना चाहिए। सूची के प्रत्येक तत्व एक वर्ग प्रकार (एक सरणी या आदिम प्रकार नहीं) होना चाहिए, और कोई डुप्लिकेट नहीं होना चाहिए। |
source_file_idx | यूंट | इस वर्ग के लिए (कम से कम अधिकांश) मूल स्रोत वाली फ़ाइल के नाम के लिए string_ids सूची में अनुक्रमणिका, या इस जानकारी की कमी का प्रतिनिधित्व करने के लिए विशेष मान NO_INDEX । किसी भी विधि का debug_info_item इस स्रोत फ़ाइल को ओवरराइड कर सकता है, लेकिन अपेक्षा यह है कि अधिकांश वर्ग केवल एक स्रोत फ़ाइल से आएंगे। |
एनोटेशन_ऑफ | यूंट | फ़ाइल की शुरुआत से इस वर्ग के लिए एनोटेशन संरचना में ऑफसेट, या 0 यदि इस वर्ग पर कोई एनोटेशन नहीं है। यह ऑफ़सेट, यदि शून्य नहीं है, तो data सेक्शन में होना चाहिए, और डेटा नीचे " annotations_directory_item " द्वारा निर्दिष्ट प्रारूप में होना चाहिए, जिसमें सभी आइटम इस वर्ग को निश्चित के रूप में संदर्भित करते हैं। |
class_data_off | यूंट | फ़ाइल की शुरुआत से इस आइटम के लिए संबंधित वर्ग डेटा में ऑफसेट, या 0 यदि इस वर्ग के लिए कोई वर्ग डेटा नहीं है। (यह मामला हो सकता है, उदाहरण के लिए, यदि यह वर्ग एक मार्कर इंटरफ़ेस है।) ऑफ़सेट, यदि शून्य नहीं है, तो data अनुभाग में होना चाहिए, और डेटा नीचे " class_data_item " द्वारा निर्दिष्ट प्रारूप में होना चाहिए, इस वर्ग को निश्चित के रूप में संदर्भित सभी वस्तुओं के साथ। |
static_values_off | यूंट | फ़ाइल की शुरुआत से static फ़ील्ड के लिए प्रारंभिक मानों की सूची में ऑफ़सेट करें, या 0 यदि कोई नहीं है (और सभी static फ़ील्ड को 0 या null के साथ प्रारंभ किया जाना है)। यह ऑफसेट data अनुभाग में होना चाहिए, और डेटा नीचे " encoded_array_item " द्वारा निर्दिष्ट प्रारूप में होना चाहिए। सरणी का आकार इस वर्ग द्वारा घोषित static क्षेत्रों की संख्या से बड़ा नहीं होना चाहिए, और तत्व static फ़ील्ड से उसी क्रम में मेल खाते हैं जैसा कि संबंधित field_list में घोषित किया गया है। प्रत्येक सरणी तत्व का प्रकार उसके संबंधित फ़ील्ड के घोषित प्रकार से मेल खाना चाहिए। यदि static फ़ील्ड की तुलना में सरणी में कम तत्व हैं, तो बचे हुए फ़ील्ड को टाइप-उपयुक्त 0 या null के साथ प्रारंभ किया जाता है। |
call_site_id_item
call_site_ids अनुभाग में दिखाई देता है
संरेखण: 4 बाइट्स
नाम | प्रारूप | विवरण |
---|---|---|
call_site_off | यूंट | साइट परिभाषा को कॉल करने के लिए फ़ाइल की शुरुआत से ऑफ़सेट करें। ऑफ़सेट डेटा अनुभाग में होना चाहिए, और डेटा नीचे "call_site_item" द्वारा निर्दिष्ट प्रारूप में होना चाहिए। |
call_site_item
डेटा अनुभाग में दिखाई देता है
संरेखण: कोई नहीं (बाइट संरेखित)
call_site_item एक एन्कोडेड_एरे_आइटम है जिसके तत्व बूटस्ट्रैप लिंकर विधि को दिए गए तर्कों के अनुरूप हैं। पहले तीन तर्क हैं:
- बूटस्ट्रैप लिंकर विधि (VALUE_METHOD_HANDLE) का प्रतिनिधित्व करने वाला एक विधि हैंडल।
- एक विधि नाम जिसे बूटस्ट्रैप लिंकर को हल करना चाहिए (VALUE_STRING)।
- A method type corresponding to the type of the method name to be resolved (VALUE_METHOD_TYPE).
Any additional arguments are constant values passed to the bootstrap linker method. These arguments are passed in order and without any type conversions.
The method handle representing the bootstrap linker method must have return type java.lang.invoke.CallSite
. The first three parameter types are:
-
java.lang.invoke.Lookup
-
java.lang.String
-
java.lang.invoke.MethodType
The parameter types of any additional arguments are determined from their constant values.
method_handle_item
appears in the method_handles section
alignment: 4 bytes
Name | Format | विवरण |
---|---|---|
method_handle_type | ushort | type of the method handle; see table below |
unused | ushort | (unused) |
field_or_method_id | ushort | Field or method id depending on whether the method handle type is an accessor or a method invoker |
unused | ushort | (unused) |
Method Handle Type Codes
Constant | Value | विवरण |
---|---|---|
METHOD_HANDLE_TYPE_STATIC_PUT | 0x00 | Method handle is a static field setter (accessor) |
METHOD_HANDLE_TYPE_STATIC_GET | 0x01 | Method handle is a static field getter (accessor) |
METHOD_HANDLE_TYPE_INSTANCE_PUT | 0x02 | Method handle is an instance field setter (accessor) |
METHOD_HANDLE_TYPE_INSTANCE_GET | 0x03 | Method handle is an instance field getter (accessor) |
METHOD_HANDLE_TYPE_INVOKE_STATIC | 0x04 | Method handle is a static method invoker |
METHOD_HANDLE_TYPE_INVOKE_INSTANCE | 0x05 | Method handle is an instance method invoker |
METHOD_HANDLE_TYPE_INVOKE_CONSTRUCTOR | 0x06 | Method handle is a constructor method invoker |
METHOD_HANDLE_TYPE_INVOKE_DIRECT | 0x07 | Method handle is a direct method invoker |
METHOD_HANDLE_TYPE_INVOKE_INTERFACE | 0x08 | Method handle is an interface method invoker |
class_data_item
referenced from class_def_item
appears in the data section
alignment: none (byte-aligned)
Name | Format | विवरण |
---|---|---|
static_fields_size | uleb128 | the number of static fields defined in this item |
instance_fields_size | uleb128 | the number of instance fields defined in this item |
direct_methods_size | uleb128 | the number of direct methods defined in this item |
virtual_methods_size | uleb128 | the number of virtual methods defined in this item |
static_fields | encoded_field[static_fields_size] | the defined static fields, represented as a sequence of encoded elements. The fields must be sorted by field_idx in increasing order. |
instance_fields | encoded_field[instance_fields_size] | the defined instance fields, represented as a sequence of encoded elements. The fields must be sorted by field_idx in increasing order. |
direct_methods | encoded_method[direct_methods_size] | the defined direct (any of static , private , or constructor) methods, represented as a sequence of encoded elements. The methods must be sorted by method_idx in increasing order. |
virtual_methods | encoded_method[virtual_methods_size] | the defined virtual (none of static , private , or constructor) methods, represented as a sequence of encoded elements. This list should not include inherited methods unless overridden by the class that this item represents. The methods must be sorted by method_idx in increasing order. The method_idx of a virtual method must not be the same as any direct method. |
Note: All elements' field_id
s and method_id
s must refer to the same defining class.
encoded_field format
Name | Format | विवरण |
---|---|---|
field_idx_diff | uleb128 | index into the field_ids list for the identity of this field (includes the name and descriptor), represented as a difference from the index of previous element in the list. The index of the first element in a list is represented directly. |
access_flags | uleb128 | access flags for the field ( public , final , etc.). See " access_flags Definitions" for details. |
encoded_method format
Name | Format | विवरण |
---|---|---|
method_idx_diff | uleb128 | index into the method_ids list for the identity of this method (includes the name and descriptor), represented as a difference from the index of previous element in the list. The index of the first element in a list is represented directly. |
access_flags | uleb128 | access flags for the method ( public , final , etc.). See " access_flags Definitions" for details. |
code_off | uleb128 | offset from the start of the file to the code structure for this method, or 0 if this method is either abstract or native . The offset should be to a location in the data section. The format of the data is specified by " code_item " below. |
type_list
referenced from class_def_item and proto_id_item
appears in the data section
alignment: 4 bytes
Name | Format | विवरण |
---|---|---|
size | uint | size of the list, in entries |
list | type_item[size] | elements of the list |
type_item format
Name | Format | विवरण |
---|---|---|
type_idx | ushort | index into the type_ids list |
code_item
referenced from encoded_method
appears in the data section
alignment: 4 bytes
Name | Format | विवरण |
---|---|---|
registers_size | ushort | the number of registers used by this code |
ins_size | ushort | the number of words of incoming arguments to the method that this code is for |
outs_size | ushort | the number of words of outgoing argument space required by this code for method invocation |
tries_size | ushort | the number of try_item s for this instance. If non-zero, then these appear as the tries array just after the insns in this instance. |
debug_info_off | uint | offset from the start of the file to the debug info (line numbers + local variable info) sequence for this code, or 0 if there simply is no information. The offset, if non-zero, should be to a location in the data section. The format of the data is specified by " debug_info_item " below. |
insns_size | uint | size of the instructions list, in 16-bit code units |
insns | ushort[insns_size] | actual array of bytecode. The format of code in an insns array is specified by the companion document Dalvik bytecode . Note that though this is defined as an array of ushort , there are some internal structures that prefer four-byte alignment. Also, if this happens to be in an endian-swapped file, then the swapping is only done on individual ushort s and not on the larger internal structures. |
padding | ushort (optional) = 0 | two bytes of padding to make tries four-byte aligned. This element is only present if tries_size is non-zero and insns_size is odd. |
tries | try_item[tries_size] (optional) | array indicating where in the code exceptions are caught and how to handle them. Elements of the array must be non-overlapping in range and in order from low to high address. This element is only present if tries_size is non-zero. |
handlers | encoded_catch_handler_list (optional) | bytes representing a list of lists of catch types and associated handler addresses. Each try_item has a byte-wise offset into this structure. This element is only present if tries_size is non-zero. |
try_item format
Name | Format | विवरण |
---|---|---|
start_addr | uint | start address of the block of code covered by this entry. The address is a count of 16-bit code units to the start of the first covered instruction. |
insn_count | ushort | number of 16-bit code units covered by this entry. The last code unit covered (inclusive) is start_addr + insn_count - 1 . |
handler_off | ushort | offset in bytes from the start of the associated encoded_catch_hander_list to the encoded_catch_handler for this entry. This must be an offset to the start of an encoded_catch_handler . |
encoded_catch_handler_list format
Name | Format | विवरण |
---|---|---|
size | uleb128 | size of this list, in entries |
list | encoded_catch_handler[handlers_size] | actual list of handler lists, represented directly (not as offsets), and concatenated sequentially |
encoded_catch_handler format
Name | Format | विवरण |
---|---|---|
size | sleb128 | number of catch types in this list. If non-positive, then this is the negative of the number of catch types, and the catches are followed by a catch-all handler. For example: A size of 0 means that there is a catch-all but no explicitly typed catches. A size of 2 means that there are two explicitly typed catches and no catch-all. And a size of -1 means that there is one typed catch along with a catch-all. |
handlers | encoded_type_addr_pair[abs(size)] | stream of abs(size) encoded items, one for each caught type, in the order that the types should be tested. |
catch_all_addr | uleb128 (optional) | bytecode address of the catch-all handler. This element is only present if size is non-positive. |
encoded_type_addr_pair format
Name | Format | विवरण |
---|---|---|
type_idx | uleb128 | index into the type_ids list for the type of the exception to catch |
addr | uleb128 | bytecode address of the associated exception handler |
debug_info_item
referenced from code_item
appears in the data section
alignment: none (byte-aligned)
Each debug_info_item
defines a DWARF3-inspired byte-coded state machine that, when interpreted, emits the positions table and (potentially) the local variable information for a code_item
. The sequence begins with a variable-length header (the length of which depends on the number of method parameters), is followed by the state machine bytecodes, and ends with an DBG_END_SEQUENCE
byte.
The state machine consists of five registers. The address
register represents the instruction offset in the associated insns_item
in 16-bit code units. The address
register starts at 0
at the beginning of each debug_info
sequence and must only monotonically increase. The line
register represents what source line number should be associated with the next positions table entry emitted by the state machine. It is initialized in the sequence header, and may change in positive or negative directions but must never be less than 1
. The source_file
register represents the source file that the line number entries refer to. It is initialized to the value of source_file_idx
in class_def_item
. The other two variables, prologue_end
and epilogue_begin
, are boolean flags (initialized to false
) that indicate whether the next position emitted should be considered a method prologue or epilogue. The state machine must also track the name and type of the last local variable live in each register for the DBG_RESTART_LOCAL
code.
The header is as follows:
Name | Format | विवरण |
---|---|---|
line_start | uleb128 | the initial value for the state machine's line register. Does not represent an actual positions entry. |
parameters_size | uleb128 | the number of parameter names that are encoded. There should be one per method parameter, excluding an instance method's this , if any. |
parameter_names | uleb128p1[parameters_size] | string index of the method parameter name. An encoded value of NO_INDEX indicates that no name is available for the associated parameter. The type descriptor and signature are implied from the method descriptor and signature. |
The byte code values are as follows:
Name | Value | Format | Arguments | विवरण |
---|---|---|---|---|
DBG_END_SEQUENCE | 0x00 | (none) | terminates a debug info sequence for a code_item | |
DBG_ADVANCE_PC | 0x01 | uleb128 addr_diff | addr_diff : amount to add to address register | advances the address register without emitting a positions entry |
DBG_ADVANCE_LINE | 0x02 | sleb128 line_diff | line_diff : amount to change line register by | advances the line register without emitting a positions entry |
DBG_START_LOCAL | 0x03 | uleb128 register_num uleb128p1 name_idx uleb128p1 type_idx | register_num : register that will contain localname_idx : string index of the nametype_idx : type index of the type | introduces a local variable at the current address. Either name_idx or type_idx may be NO_INDEX to indicate that that value is unknown. |
DBG_START_LOCAL_EXTENDED | 0x04 | uleb128 register_num uleb128p1 name_idx uleb128p1 type_idx uleb128p1 sig_idx | register_num : register that will contain localname_idx : string index of the nametype_idx : type index of the typesig_idx : string index of the type signature | introduces a local with a type signature at the current address. Any of name_idx , type_idx , or sig_idx may be NO_INDEX to indicate that that value is unknown. (If sig_idx is -1 , though, the same data could be represented more efficiently using the opcode DBG_START_LOCAL .) Note: See the discussion under " |
DBG_END_LOCAL | 0x05 | uleb128 register_num | register_num : register that contained local | marks a currently-live local variable as out of scope at the current address |
DBG_RESTART_LOCAL | 0x06 | uleb128 register_num | register_num : register to restart | re-introduces a local variable at the current address. The name and type are the same as the last local that was live in the specified register. |
DBG_SET_PROLOGUE_END | 0x07 | (none) | sets the prologue_end state machine register, indicating that the next position entry that is added should be considered the end of a method prologue (an appropriate place for a method breakpoint). The prologue_end register is cleared by any special ( >= 0x0a ) opcode. | |
DBG_SET_EPILOGUE_BEGIN | 0x08 | (none) | sets the epilogue_begin state machine register, indicating that the next position entry that is added should be considered the beginning of a method epilogue (an appropriate place to suspend execution before method exit). The epilogue_begin register is cleared by any special ( >= 0x0a ) opcode. | |
DBG_SET_FILE | 0x09 | uleb128p1 name_idx | name_idx : string index of source file name; NO_INDEX if unknown | indicates that all subsequent line number entries make reference to this source file name, instead of the default name specified in code_item |
Special Opcodes | 0x0a…0xff | (none) | advances the line and address registers, emits a position entry, and clears prologue_end and epilogue_begin . See below for description. |
Special opcodes
Opcodes with values between 0x0a
and 0xff
(inclusive) move both the line
and address
registers by a small amount and then emit a new position table entry. The formula for the increments are as follows:
DBG_FIRST_SPECIAL = 0x0a // the smallest special opcode DBG_LINE_BASE = -4 // the smallest line number increment DBG_LINE_RANGE = 15 // the number of line increments represented adjusted_opcode = opcode - DBG_FIRST_SPECIAL line += DBG_LINE_BASE + (adjusted_opcode % DBG_LINE_RANGE) address += (adjusted_opcode / DBG_LINE_RANGE)
annotations_directory_item
referenced from class_def_item
appears in the data section
alignment: 4 bytes
Name | Format | विवरण |
---|---|---|
class_annotations_off | uint | offset from the start of the file to the annotations made directly on the class, or 0 if the class has no direct annotations. The offset, if non-zero, should be to a location in the data section. The format of the data is specified by " annotation_set_item " below. |
fields_size | uint | count of fields annotated by this item |
annotated_methods_size | uint | count of methods annotated by this item |
annotated_parameters_size | uint | count of method parameter lists annotated by this item |
field_annotations | field_annotation[fields_size] (optional) | list of associated field annotations. The elements of the list must be sorted in increasing order, by field_idx . |
method_annotations | method_annotation[methods_size] (optional) | list of associated method annotations. The elements of the list must be sorted in increasing order, by method_idx . |
parameter_annotations | parameter_annotation[parameters_size] (optional) | list of associated method parameter annotations. The elements of the list must be sorted in increasing order, by method_idx . |
Note: All elements' field_id
s and method_id
s must refer to the same defining class.
field_annotation format
Name | Format | विवरण |
---|---|---|
field_idx | uint | index into the field_ids list for the identity of the field being annotated |
annotations_off | uint | offset from the start of the file to the list of annotations for the field. The offset should be to a location in the data section. The format of the data is specified by " annotation_set_item " below. |
method_annotation format
Name | Format | विवरण |
---|---|---|
method_idx | uint | index into the method_ids list for the identity of the method being annotated |
annotations_off | uint | offset from the start of the file to the list of annotations for the method. The offset should be to a location in the data section. The format of the data is specified by " annotation_set_item " below. |
parameter_annotation format
Name | Format | विवरण |
---|---|---|
method_idx | uint | index into the method_ids list for the identity of the method whose parameters are being annotated |
annotations_off | uint | offset from the start of the file to the list of annotations for the method parameters. The offset should be to a location in the data section. The format of the data is specified by " annotation_set_ref_list " below. |
annotation_set_ref_list
referenced from parameter_annotations_item
appears in the data section
alignment: 4 bytes
Name | Format | विवरण |
---|---|---|
size | uint | size of the list, in entries |
list | annotation_set_ref_item[size] | elements of the list |
annotation_set_ref_item format
Name | Format | विवरण |
---|---|---|
annotations_off | uint | offset from the start of the file to the referenced annotation set or 0 if there are no annotations for this element. The offset, if non-zero, should be to a location in the data section. The format of the data is specified by " annotation_set_item " below. |
annotation_set_item
referenced from annotations_directory_item, field_annotations_item, method_annotations_item, and annotation_set_ref_item
appears in the data section
alignment: 4 bytes
Name | Format | विवरण |
---|---|---|
size | uint | size of the set, in entries |
entries | annotation_off_item[size] | elements of the set. The elements must be sorted in increasing order, by type_idx . |
annotation_off_item format
Name | Format | विवरण |
---|---|---|
annotation_off | uint | offset from the start of the file to an annotation. The offset should be to a location in the data section, and the format of the data at that location is specified by " annotation_item " below. |
annotation_item
referenced from annotation_set_item
appears in the data section
alignment: none (byte-aligned)
Name | Format | विवरण |
---|---|---|
visibility | ubyte | intended visibility of this annotation (see below) |
annotation | encoded_annotation | encoded annotation contents, in the format described by " encoded_annotation format" under " encoded_value encoding" above. |
Visibility values
These are the options for the visibility
field in an annotation_item
:
Name | Value | विवरण |
---|---|---|
VISIBILITY_BUILD | 0x00 | intended only to be visible at build time (eg, during compilation of other code) |
VISIBILITY_RUNTIME | 0x01 | intended to visible at runtime |
VISIBILITY_SYSTEM | 0x02 | intended to visible at runtime, but only to the underlying system (and not to regular user code) |
encoded_array_item
referenced from class_def_item
appears in the data section
alignment: none (byte-aligned)
Name | Format | विवरण |
---|---|---|
value | encoded_array | bytes representing the encoded array value, in the format specified by " encoded_array Format" under " encoded_value Encoding" above. |
hiddenapi_class_data_item
This section contains data on restricted interfaces used by each class.
Note: The hidden API feature was introduced in Android 10.0 and is only applicable to the DEX files of classes in the boot class path. The list of flags described below may be extended in the future releases of Android. For more information, see restrictions on non-SDK interfaces .
Name | Format | विवरण |
---|---|---|
size | uint | total size of the section |
offsets | uint[] | array of offsets indexed by class_idx . A zero array entry at index class_idx means that either there is no data for this class_idx , or all hidden API flags are zero. Otherwise the array entry is non-zero and contains an offset from the beginning of the section to an array of hidden API flags for this class_idx . |
flags | uleb128[] | concatenated arrays of hidden API flags for each class. Possible flag values are described in the table below. Flags are encoded in the same order as fields and methods are encoded in class data. |
Restriction flag types:
Name | Value | विवरण |
---|---|---|
whitelist | 0 | Interfaces that can be freely used and are supported as part of the officially documented Android framework Package Index . |
greylist | 1 | Non-SDK interfaces that can be used regardless of the application's target API level . |
blacklist | 2 | Non-SDK interfaces that cannot be used regardless of the application's target API level . Accessing one of these interfaces causes a runtime error . |
greylist‑max‑o | 3 | Non-SDK interfaces that can be used for Android 8.x and below unless they are restricted. |
greylist‑max‑p | 4 | Non-SDK interfaces that can be used for Android 9.x unless they are restricted. |
greylist‑max‑q | 5 | Non-SDK interfaces that can be used for Android 10.x unless they are restricted. |
greylist‑max‑r | 6 | Non-SDK interfaces that can be used for Android 11.x unless they are restricted. |
System annotations
System annotations are used to represent various pieces of reflective information about classes (and methods and fields). This information is generally only accessed indirectly by client (non-system) code.
System annotations are represented in .dex
files as annotations with visibility set to VISIBILITY_SYSTEM
.
dalvik.annotation.AnnotationDefault
appears on methods in annotation interfaces
An AnnotationDefault
annotation is attached to each annotation interface which wishes to indicate default bindings.
Name | Format | विवरण |
---|---|---|
value | Annotation | the default bindings for this annotation, represented as an annotation of this type. The annotation need not include all names defined by the annotation; missing names simply do not have defaults. |
dalvik.annotation.EnclosingClass
appears on classes
An EnclosingClass
annotation is attached to each class which is either defined as a member of another class, per se, or is anonymous but not defined within a method body (eg, a synthetic inner class). Every class that has this annotation must also have an InnerClass
annotation. Additionally, a class must not have both an EnclosingClass
and an EnclosingMethod
annotation.
Name | Format | विवरण |
---|---|---|
value | Class | the class which most closely lexically scopes this class |
dalvik.annotation.EnclosingMethod
appears on classes
An EnclosingMethod
annotation is attached to each class which is defined inside a method body. Every class that has this annotation must also have an InnerClass
annotation. Additionally, a class must not have both an EnclosingClass
and an EnclosingMethod
annotation.
Name | Format | विवरण |
---|---|---|
value | Method | the method which most closely lexically scopes this class |
dalvik.annotation.InnerClass
appears on classes
An InnerClass
annotation is attached to each class which is defined in the lexical scope of another class's definition. Any class which has this annotation must also have either an EnclosingClass
annotation or an EnclosingMethod
annotation.
Name | Format | विवरण |
---|---|---|
name | String | the originally declared simple name of this class (not including any package prefix). If this class is anonymous, then the name is null . |
accessFlags | int | the originally declared access flags of the class (which may differ from the effective flags because of a mismatch between the execution models of the source language and target virtual machine) |
dalvik.annotation.MemberClasses
appears on classes
A MemberClasses
annotation is attached to each class which declares member classes. (A member class is a direct inner class that has a name.)
Name | Format | विवरण |
---|---|---|
value | Class[] | array of the member classes |
dalvik.annotation.MethodParameters
appears on methods
Note: This annotation was added after Android 7.1. Its presence on earlier Android releases will be ignored.
A MethodParameters
annotation is optional and can be used to provide parameter metadata such as parameter names and modifiers.
The annotation can be omitted from a method or constructor safely when the parameter metadata is not required at runtime. java.lang.reflect.Parameter.isNamePresent()
can be used to check whether metadata is present for a parameter, and the associated reflection methods such as java.lang.reflect.Parameter.getName()
will fall back to default behavior at runtime if the information is not present.
When including parameter metadata, compilers must include information for generated classes such as enums, since the parameter metadata includes whether or not a parameter is synthetic or mandated.
A MethodParameters
annotation describes only individual method parameters. Therefore, compilers may omit the annotation entirely for constructors and methods that have no parameters, for the sake of code-size and runtime efficiency.
The arrays documented below must be the same size as for the method_id_item
dex structure associated with the method, otherwise a java.lang.reflect.MalformedParametersException
will be thrown at runtime.
That is: method_id_item.proto_idx
-> proto_id_item.parameters_off
-> type_list.size
must be the same as names().length
and accessFlags().length
.
Because MethodParameters
describes all formal method parameters, even those not explicitly or implicitly declared in source code, the size of the arrays may differ from the Signature or other metadata information that is based only on explicit parameters declared in source code. MethodParameters
will also not include any information about type annotation receiver parameters that do not exist in the actual method signature.
Name | Format | विवरण |
---|---|---|
names | String[] | The names of formal parameters for the associated method. The array must not be null but must be empty if there are no formal parameters. A value in the array must be null if the formal parameter with that index has no name. If parameter name strings are empty or contain '.', ';', '[' or '/' then a java.lang.reflect.MalformedParametersException will be thrown at runtime. |
accessFlags | int[] | The access flags of the formal parameters for the associated method. The array must not be null but must be empty if there are no formal parameters. The value is a bit mask with the following values:
java.lang.reflect.MalformedParametersException will be thrown at runtime. |
dalvik.annotation.Signature
appears on classes, fields, and methods
A Signature
annotation is attached to each class, field, or method which is defined in terms of a more complicated type than is representable by a type_id_item
. The .dex
format does not define the format for signatures; it is merely meant to be able to represent whatever signatures a source language requires for successful implementation of that language's semantics. As such, signatures are not generally parsed (or verified) by virtual machine implementations. The signatures simply get handed off to higher-level APIs and tools (such as debuggers). Any use of a signature, therefore, should be written so as not to make any assumptions about only receiving valid signatures, explicitly guarding itself against the possibility of coming across a syntactically invalid signature.
Because signature strings tend to have a lot of duplicated content, a Signature
annotation is defined as an array of strings, where duplicated elements naturally refer to the same underlying data, and the signature is taken to be the concatenation of all the strings in the array. There are no rules about how to pull apart a signature into separate strings; that is entirely up to the tools that generate .dex
files.
Name | Format | विवरण |
---|---|---|
value | String[] | the signature of this class or member, as an array of strings that is to be concatenated together |
dalvik.annotation.Throws
appears on methods
A Throws
annotation is attached to each method which is declared to throw one or more exception types.
Name | Format | विवरण |
---|---|---|
value | Class[] | the array of exception types thrown |