{"id":346580,"date":"2023-03-11T15:00:16","date_gmt":"2023-03-11T15:00:16","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=346580"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=346580","title":{"rendered":"<span>\u041d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 android: \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0441 sun.misc.Unsafe. \u0427\u0430\u0441\u0442\u044c 2<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u043a\u043b\u0430\u0441\u0441\u0430\u0445-\u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0430\u0445 \u0432 ART \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u043e\u043b\u0435\u0439, \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u0432 \u043c\u0435\u0442\u043e\u0434 \u0438 \u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0435 \u043d\u0430 \u0433\u043e\u0442\u043e\u0432\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/539\/eb1\/9d3\/539eb19d3d66d2a92e17e40bf97fce86.png\" width=\"790\" height=\"360\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/539\/eb1\/9d3\/539eb19d3d66d2a92e17e40bf97fce86.png\"\/><\/figure>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/habr.com\/ru\/post\/720788\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 1<\/a>. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 arrayCast \u0438 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435.<\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/721054\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 2<\/a>. \u041a\u043b\u0430\u0441\u0441\u044b-\u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0438. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439, \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u0432 \u043c\u0435\u0442\u043e\u0434\u044b. \u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440.<\/p>\n<\/div>\n<\/details>\n<p><strong>\u041a\u043b\u0430\u0441\u0441\u044b-\u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0438<\/strong><\/p>\n<p>\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441 arrayCast`\u043e\u043c \u2014 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u0430\u043a \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0434\u0440\u0443\u0433\u043e\u0439. \u0412 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043b\u0435\u0436\u0438\u0442 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 &#8212; \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u0439\u0442\u043e\u0432, \u0438 \u043a\u0430\u043a \u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043b\u0438\u0448\u044c \u043e\u0442 \u043d\u0430\u0441. \u042d\u0442\u0438\u043c \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0430\u043d\u0434\u0440\u043e\u0438\u0434\u0430, \u0445\u0440\u0430\u043d\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u0430\u043a \u0432\u0438\u0434\u043e\u0438\u0437\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0430 MirrorType \u2014 \u043a\u043b\u0430\u0441\u0441\u044b-\u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u044f\u0437\u044b\u043a\u0430 C++ \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438 (\u0447\u0442\u043e\u0431\u044b \u043c\u0430\u043a\u0435\u0442\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u043b\u0438 \u043c\u0435\u0436\u0434\u0443 \u044f\u0437\u044b\u043a\u0430\u043c\u0438).<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0434\u0432\u043e\u0439\u043d\u0438\u043a\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/android.googlesource.com\/platform\/art\/+\/refs\/heads\/master\/runtime\/mirror\/object.h\" rel=\"noopener noreferrer nofollow\">object.h<\/a><\/p>\n<pre><code class=\"cpp\">\/\/ C++ mirror of java.lang.Object class MANAGED LOCKABLE Object {   &lt;...>   \/\/ The Class representing the type of the object.   HeapReference&lt;Class> klass_;   \/\/ Monitor and hash code information.   uint32_t monitor_;   &lt;...> };<\/code><\/pre>\n<p><a href=\"https:\/\/android.googlesource.com\/platform\/art\/+\/refs\/heads\/master\/runtime\/mirror\/throwable.h\" rel=\"noopener noreferrer nofollow\">throwable.h<\/a><\/p>\n<pre><code class=\"cpp\">\/\/ C++ mirror of java.lang.Throwable class MANAGED Throwable : public Object {   &lt;...>   HeapReference&lt;Object> backtrace_;   HeapReference&lt;Throwable> cause_;   HeapReference&lt;String> detail_message_;   HeapReference&lt;Object> stack_trace_;   HeapReference&lt;Object> suppressed_exceptions_;   &lt;...> };<\/code><\/pre>\n<p><a href=\"https:\/\/android.googlesource.com\/platform\/art\/+\/refs\/heads\/master\/runtime\/mirror\/string.h\" rel=\"noopener noreferrer nofollow\">string.h<\/a><\/p>\n<pre><code class=\"cpp\">\/\/ C++ mirror of java.lang.String class MANAGED String final : public Object {   &lt;...>   \/\/ If string compression is enabled, count_ holds the StringCompressionFlag in the   \/\/ least significant bit and the length in the remaining bits, length = count_ >> 1.   int32_t count_;   uint32_t hash_code_;   \/\/ Compression of all-ASCII into 8-bit memory leads to usage one of these fields   union {     uint16_t value_[0];     uint8_t value_compressed_[0];   };   &lt;...> };<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043f\u043e\u043b\u0435\u0439 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 java \u0438 c++ \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430\u043c\u0438 \u0440\u0430\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u043e\u043b\u0435\u0439 \u0432 \u044d\u0442\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445. \u0427\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 &#171;ValidateFieldOrderOfJavaCppUnionClasses&#187; \u2014 \u0440\u044f\u0434 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043a\u043b\u0430\u0441\u0441\u044b-\u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0438 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 java, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u044b \u0437\u0430\u0440\u0430\u043d\u0435\u0435. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u2014 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u0442\u0438\u043f\u0430\u043c\u0438 \u0438 \u0438\u043c\u0435\u043d\u0430\u043c\u0438, \u0447\u0442\u043e \u0438 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443.<\/p>\n<p><strong>\u0417\u0430\u043b\u0435\u0437\u0430\u0435\u043c \u0432 \u043a\u043b\u0430\u0441\u0441<\/strong><\/p>\n<p>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u0412\u0441\u0435 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u044e\u0442 android 8.0+ \u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445. \u0412\u0435\u0440\u0445\u043d\u0435\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043d\u043e \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u0441 android 14 DP2 \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u043e\u0439\u043d\u0438\u043a\u043e\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043a\u043b\u0430\u0441\u0441\u044b-\u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">public class ClassMirror {   public ClassLoader classLoader;   public Class&lt;?> componentType;   public Object dexCache;   public Object extData;   public Object[] ifTable;   public String name;   public Class&lt;?> superClass;   public Object vtable;   public long iFields;   public long methods;   public long sFields;   public int accessFlags;   public int classFlags;   public int classSize;   public int clinitThreadId;   public int dexClassDefIndex;   public volatile int dexTypeIndex;   public int numReferenceInstanceFields;   public int numReferenceStaticFields;   public int objectSize;   public int objectSizeAllocFastPath;   public int primitiveType;   public int referenceInstanceOffsets;   public int status;   public short copiedMethodsOffset;   public short virtualMethodsOffset; }  public class AccessibleObjectMirror {   public boolean override; }  public class FieldMirror extends AccessibleObjectMirror {   public int accessFlags;   public Class&lt;?> declaringClass;   public int artFieldIndex;   public int offset;   public Class&lt;?> type; }  public class ExecutableMirror extends AccessibleObjectMirror {   public volatile boolean hasRealParameterData;   public volatile Parameter[] parameters;   public int accessFlags;   public long artMethod;   public Class&lt;?> declaringClass;   public Class&lt;?> declaringClassOfOverriddenMethod;   public int dexMethodIndex; }  public class MethodHandleMirror {   public MethodType type;   \/\/ \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u043b\u0435 \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438,   \/\/ \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0440\u0443\u0448\u0435\u043d,   \/\/ \u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043d\u0435 \u0432\u0430\u0436\u043d\u043e, \u0442.\u043a.   \/\/ \u043c\u044b \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u044d\u0442\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043a \"\u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0435\u043c\"   public Object different;   public MethodHandleImplMirror cachedSpreadInvoker;   public int handleKind;   public long artFieldOrMethod; }  public class MethodHandleImplMirror extends MethodHandleMirror {   public HandleInfoMirror info; }  public class HandleInfoMirror {   public Member member;   public MethodHandleImplMirror handle; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u043b\u044f iFields, sFields \u0438 methods \u0432 ClassMirror \u2014 \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u0442\u0438\u043f long, \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 C++ \u043a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/android.googlesource.com\/platform\/art\/+\/refs\/heads\/master\/libartbase\/base\/length_prefixed_array.h\" rel=\"noopener noreferrer nofollow\">LengthPrefixedArray<\/a>.<\/p>\n<pre><code class=\"cpp\">template&lt;typename T> class LengthPrefixedArray {   &lt;...>   uint32_t size_;   uint8_t data_[0];   &lt;...> };<\/code><\/pre>\n<p>\u0417\u0430\u043c\u0435\u0442\u043a\u0430: \u0410\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 32 \u0438\u043b\u0438 64 \u0431\u0438\u0442, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u043d\u043e \u0432\u0441\u0435 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b java \u0438\u043c\u0435\u044e\u0442 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u0442, \u0447\u0442\u043e \u0432\u043c\u0435\u0449\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435. \u041d\u0430 32-\u0431\u0438\u0442\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0447\u0438\u0441\u043b\u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u2014 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u044d\u043a\u043e\u043d\u043e\u043c\u043d\u043e, \u0437\u0430\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>\u0412 iFields \u0438 sFields \u044d\u0442\u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0445\u0440\u0430\u043d\u0438\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b <a href=\"https:\/\/android.googlesource.com\/platform\/art\/+\/refs\/heads\/master\/runtime\/art_field.h\" rel=\"noopener noreferrer nofollow\">ArtField<\/a>, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u0435. \u041f\u0440\u0435\u0444\u0438\u043a\u0441 s \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u043b\u044f, i \u2014 \u043f\u043e\u043b\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430. \u0412 methods \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f <a href=\"https:\/\/android.googlesource.com\/platform\/art\/+\/refs\/heads\/master\/runtime\/art_method.h\" rel=\"noopener noreferrer nofollow\">ArtMethod<\/a>`\u044b, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b (\u0414\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0435, \u0432\u0435\u0434\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043c\u0435\u0442\u043e\u0434 \u0441\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c. \u041f\u043e\u0437\u0436\u0435 \u044d\u0442\u043e \u0437\u043d\u0430\u043d\u0438\u0435 \u043d\u0430\u043c \u0435\u0449\u0451 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f). \u0418\u0437 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u044d\u0442\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0430\u043d\u0434\u0440\u043e\u0438\u0434 \u0443\u043c\u0435\u0435\u0442 &#171;\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c&#187; \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b Field, Method \u0438 Constructor \u2014 \u0430 \u0432\u0435\u0434\u044c \u044d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e!<\/p>\n<p><strong>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430, \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0440\u043e\u0441\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439, \u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0432 \u043b\u044f\u043c\u0431\u0434\u0443 \u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441 throwException \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438<\/p>\n<details class=\"spoiler\">\n<summary>\u041e\u0431\u0451\u0440\u0442\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">@FunctionalInterface public interface TRun&lt;T> {   public T run() throws Throwable; }  public static &lt;T> T nothrows_run(TRun&lt;T> r) {   try {     return r.run();   } catch (Throwable th) {     Thrower.throwException(th);     throw new RuntimeException(th);   } }  \/\/ void \u0432\u0435\u0440\u0441\u0438\u044f @FunctionalInterface public interface VTRun {   public void run() throws Throwable; }  public static void nothrows_run(VTRun r) {   try {     r.run();   } catch (Throwable th) {     Thrower.throwException(th);     throw new RuntimeException(th);   } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 Executable<\/strong><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e LengthPrefixedArray, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u0447\u0430\u043b\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u0442\u0441\u0442\u0443\u043f \u0434\u043b\u044f \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cpp\">static size_t OffsetOfElement(size_t index,                               size_t element_size = sizeof(T),                               size_t alignment = alignof(T)) {   DCHECK_ALIGNED_PARAM(element_size, alignment);   \/\/ \u041e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0434\u043e \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f   return RoundUp(offsetof(LengthPrefixedArray&lt;T>, data_), alignment) + index * element_size; }<\/code><\/pre>\n<p>\u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430 java, \u043d\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c \u043d\u0438 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435, \u043d\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435.<\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u0434\u043b\u044f \u043d\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0430 Executable. \u041e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0438 \u0432\u0441\u0435 \u043f\u043e\u043b\u044f. \u041e\u0434\u043d\u043e \u0438\u0437 \u043d\u0438\u0445 \u2014 artMethod \u2014 \u044d\u0442\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0443\u044e \u043d\u0430\u0441 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. \u041f\u043e \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0432 \u0434\u0432\u0443\u0445 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"java\">public class ArtMethod_Test {    public static final Method method_a =     nothrows_run(() -> Test.class.getDeclaredMethod(\"a\"));   public static final Method method_b =     nothrows_run(() -> Test.class.getDeclaredMethod(\"b\"));      public static void a() {}   public static void b() {} }  long getArtMethod(Executable ex) {   \/\/ \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u043c ex \u043a \u0442\u0438\u043f\u0443 ExecutableMirror   ExecutableMirror[] mirror = arrayCast(ExecutableMirror.class, ex);   return mirror[0].artMethod; }  \/\/ \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u043c ArtMethod_Test.class \u043a \u0442\u0438\u043f\u0443 ClassMirror ClassMirror[] test = arrayCast(ClassMirror.class, ArtMethod_Test.class);  long am = getArtMethod(ArtMethod_Test.method_a); long bm = getArtMethod(ArtMethod_Test.method_b);  \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u043a\u0430\u0436\u0434\u043e\u0433\u043e ArtMethod int artMethodSize = (int) (bm - am);  \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445 uint32_t \u043f\u043e\u043b\u044f size_ \u0432 LengthPrefixedArray final int size_field_length = 4;  \/\/ \u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e ArtMethod int artMethodPadding = (int) (am - test[0].methods - size_field_length)   % artMethodSize + size_field_length;<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0441\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0441\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0430 \u0432\u0441\u0435 \u0435\u0433\u043e Executable<\/p>\n<pre><code class=\"java\">\/\/ \u041a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u0430\u043b\u0435\u0435 static final Class&lt;MethodHandle> MethodHandleImplClass = nothrows_run(() -> {   return (Class&lt;MethodHandle>) Class.forName(\"java.lang.invoke.MethodHandleImpl\"); });  Executable[] getDeclaredExecutables0(Class&lt;?> clazz) {   Objects.requireNonNull(clazz);    \/\/ \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 \u043a ClassMirror   ClassMirror[] clazz_mirror = arrayCast(ClassMirror.class, clazz);   long methods = clazz_mirror[0].methods;    \/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0440\u0430\u0432\u0435\u043d 0, \u0437\u0434\u0435\u0441\u044c \u043f\u0443\u0441\u0442\u043e   if (methods == 0) {     return new Executable[0];   }    \/\/ \u0427\u0438\u0442\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e   int col = getInt(methods);   Executable[] out = new Executable[col];   if (out.length == 0) {     return out;   }    \/\/ \u042d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0443\u043c\u0435\u0435\u0442 \"\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c\" Executable \u0438 Field   MethodHandle mh = allocateInstance(MethodHandleImplClass);   MethodHandleImplMirror[] mhm = arrayCast(MethodHandleImplMirror.class, mh);      for (int i = 0; i &lt; col; i++) {     \/\/ \u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u043d\u0430\u0448 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c     mhm[0].artFieldOrMethod = methods + artMethodPadding + artMethodSize * i;     \/\/ \u041e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \"\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\"     mhm[0].info = null;     \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c!     out[i] = MethodHandles.reflectAs(Executable.class, mh);   }    \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c   return out; } <\/code><\/pre>\n<p>\u041d\u0430 \u0447\u0451\u043c \u0436\u0435 \u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043d\u0441\u0442\u0440\u0430? \u0410 \u0447\u0435\u0433\u043e \u043c\u0435\u043b\u043e\u0447\u0438\u0442\u044c\u0441\u044f, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430 Long! \u0422\u0430\u043c \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e.<\/p>\n<pre><code class=\"java\">Arrays.stream(getDeclaredExecutables0(Long.class)).forEach((ex) -> {   System.out.print(Modifier.toString(ex.getModifiers()) + \" \");   System.out.print(ex instanceof Method ? \"method \" : \"constructor \");   System.out.print(ex.getName());   String parameters = Arrays.stream(ex.getParameterTypes())     .map(Class::getName)     .collect(Collectors.joining(\", \", \"(\", \")\"));   System.out.println(parameters); });  \/\/ System.out: \/\/ static constructor java.lang.Long() \/\/ public constructor java.lang.Long(long) \/\/ public constructor java.lang.Long(java.lang.String) \/\/ public static method bitCount(long) \/\/ &lt;...> \/\/ private static method toUnsignedBigInteger(long) \/\/ &lt;...> \/\/ public method toString()<\/code><\/pre>\n<p>\u0418 \u043f\u0435\u0440\u0432\u0430\u044f \u0436\u0435 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0437\u0430\u0447\u0435\u043c \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u044b\u0432\u043e\u0434\u0430: static constructor! \u0414\u0430-\u0434\u0430, \u044d\u0442\u043e \u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430, \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f static \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c. \u0428\u0442\u0430\u0442\u043d\u044b\u0439 toString \u043d\u0435 \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0431\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438. \u0421 private  \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0442\u043e\u0436\u0435 \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438\u0441\u044c, \u0430 \u044d\u0442\u043e \u043f\u043e\u0431\u0435\u0434\u0430. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u043e\u0442\u0434\u0435\u043b\u0438\u0432 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432, \u043d\u043e \u044d\u0442\u043e \u044f \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u043d\u0430 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 (\u043b\u0438\u0431\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c <a href=\"https:\/\/github.com\/vova7878\/AndroidUnsafe\/blob\/master\/src\/com\/v7878\/unsafe\/AndroidUnsafe3.java\" rel=\"noopener noreferrer nofollow\">\u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/a>).<\/p>\n<p><strong>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 2<\/strong><\/p>\n<p>\u041c\u0435\u0442\u043e\u0434\u044b \u0438 \u043f\u043e\u043b\u044f \u0441 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c private \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u0445\u043e\u0442\u043d\u043e \u0434\u0430\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c. \u041a\u0430\u043a \u0445\u043e\u0440\u043e\u0448\u043e, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u043e\u0442 AccessibleObject \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 setAccessible. \u0410\u0445, \u0435\u0441\u043b\u0438 \u0431\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043d\u0451\u043c \u043d\u0435 \u0431\u044b\u043b\u043e \u0437\u0430\u0449\u0438\u0442\u044b&#8230; \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0432\u043e\u0439!<\/p>\n<pre><code class=\"java\">void setAccessible(AccessibleObject ao, boolean value) {   AccessibleObjectMirror[] aom = arrayCast(AccessibleObjectMirror.class, ao);   aom[0].override = value; }<\/code><\/pre>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u043f\u043e\u043b\u044f<\/strong><\/p>\n<p>\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432. \u041f\u0435\u0440\u0432\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u2014 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u043b\u044f artField \u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 getArtField. \u0417\u0430\u0431\u0430\u0432\u043d\u043e, \u0432\u0435\u0434\u044c \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043f\u043e\u043d\u044f\u043b\u0438 \u043a\u0430\u043a \u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"java\">public class ArtField_Test {    public static final Field field_a =      nothrows_run(() -> Test.class.getDeclaredField(\"sa\"));   public static final Field field_b =      nothrows_run(() -> Test.class.getDeclaredField(\"sb\"));    public static int sa, sb; }  Method mGetArtField = getDeclaredMethod(Field.class, \"getArtField\");  long getArtField(Field f) {   return (long) nothrows_run(() -> mGetArtField.invoke(f)); }  \/\/ \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u043c ArtField_Test.class \u043a \u0442\u0438\u043f\u0443 ClassMirror ClassMirror[] test = arrayCast(ClassMirror.class, ArtField_Test.class);  long af = getArtMethod(ArtField_Test.field_a); long bf = getArtMethod(ArtField_Test.field_b);  \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u043a\u0430\u0436\u0434\u043e\u0433\u043e ArtField int artFieldSize = (int) (bf - af);  \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445 uint32_t \u043f\u043e\u043b\u044f size_ \u0432 LengthPrefixedArray final int size_field_length = 4;  \/\/ \u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e ArtField \/\/ \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f sFields \u0442.\u043a. \u043f\u043e\u043b\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 int artFieldPadding = (int) (am - test[0].sFields - size_field_length)   % artFieldSize + size_field_length;<\/code><\/pre>\n<p>\u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0443\u0437\u043d\u0430\u043b\u0438? \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0439. \u0423 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u2014 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u043b\u044f \u0438 \u043f\u043e\u043b\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432\u0441\u0451 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f.<\/p>\n<pre><code class=\"java\">Field[] getDeclaredFields0(Class&lt;?> clazz, boolean s) {   Objects.requireNonNull(clazz);    \/\/ \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 \u043a ClassMirror   ClassMirror[] clazz_mirror = arrayCast(ClassMirror.class, clazz);    \/\/ \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c, \u0433\u0434\u0435 \u0438\u0441\u043a\u0430\u0442\u044c   long fields = s ? clazz_mirror[0].sFields : clazz_mirror[0].iFields;    \/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0440\u0430\u0432\u0435\u043d 0, \u0437\u0434\u0435\u0441\u044c \u043f\u0443\u0441\u0442\u043e   if (fields == 0) {     return new Field[0];   }    \/\/ \u0427\u0438\u0442\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e   int col = getInt(fields);   Field[] out = new Field[col];   if (out.length == 0) {     return out;   }    \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c \"\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\"   MethodHandle mh = allocateInstance(MethodHandleImplClass);   MethodHandleImplMirror[] mhh = arrayCast(MethodHandleImplMirror.class, mh);    for (int i = 0; i &lt; col; i++) {     \/\/ \u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u043d\u0430\u0448 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c     mhh[0].artFieldOrMethod = fields + artFieldPadding + artFieldSize * i;     \/\/ \u041e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \"\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\"     mhh[0].info = null;     \/\/ \u0421\u0438\u0433\u043d\u0430\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u043e\u043b\u0435, \u0430 \u043d\u0435 \u043c\u0435\u0442\u043e\u0434 (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043d\u0438\u0436\u0435)     mhh[0].handleKind = Integer.MAX_VALUE;     \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c!     out[i] = MethodHandles.reflectAs(Field.class, mh);   }    \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c   return out; }  \/\/ \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 Field[] getDeclaredFields(Class&lt;?> clazz) {   Field[] sout = getDeclaredFields0(clazz, true);   Field[] iout = getDeclaredFields0(clazz, false);   Field[] all = new Field[sout.length + iout.length];   System.arraycopy(sout, 0, all, 0, sout.length);   System.arraycopy(iout, 0, all, sout.length, iout.length);   return out; }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u0442\u043e\u0440\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u2014 reflectAs \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 \u0432\u0438\u0434 \u0442\u043e\u0433\u043e MethodHandle, \u0447\u0442\u043e \u043c\u044b \u0435\u043c\u0443 \u0441\u043a\u0430\u0440\u043c\u043b\u0438\u0432\u0430\u0435\u043c, \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043c\u0435\u0442\u043e\u0434 \u0438\u043b\u0438 \u043f\u043e\u043b\u0435. \u041d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u043f\u0430\u0434\u0435\u043d\u0438\u044e \u0412\u041c, \u0430 \u043d\u0430\u043c \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043d\u0430\u0434\u043e.<\/p>\n<details class=\"spoiler\">\n<summary>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f getMemberInternal<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/android.googlesource.com\/platform\/art\/+\/refs\/heads\/master\/runtime\/native\/java_lang_invoke_MethodHandleImpl.cc\" rel=\"noopener noreferrer nofollow\">java_lang_invoke_MethodHandleImpl.cc<\/a><\/p>\n<pre><code class=\"cpp\">static jobject MethodHandleImpl_getMemberInternal(JNIEnv* env, jobject thiz) {   &lt;...>   if (handle_kind >= mirror::MethodHandle::kFirstAccessorKind) {     ArtField* const field = handle->GetTargetField();     &lt;...>   } else {     ArtMethod* const method = handle->GetTargetMethod();     if (method->IsConstructor()) {       &lt;...>     } else {       &lt;...>     }   }   &lt;...> }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\u043c handle_kind \u0441 \u043d\u0435\u043a\u0438\u043c kFirstAccessorKind. \u041c\u044b \u0435\u0433\u043e \u0437\u043d\u0430\u0435\u043c? \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0434\u0430, \u043d\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0430\u043d\u0434\u0440\u043e\u0438\u0434\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043c \u043f\u0440\u043e\u0449\u0435 \u2014 \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e kFirstAccessorKind \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u0438 \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0435\u0433\u043e \u2014 \u043c\u0435\u0442\u043e\u0434, \u0431\u043e\u043b\u044c\u0448\u0435 \u2014 \u043f\u043e\u043b\u0435. \u0422\u043e\u0433\u0434\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0431\u0435\u0440\u0451\u043c 0, \u0430 \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e Integer.MAX_VALUE, \u0438 \u0432\u0441\u0451 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u0418\u0441\u043f\u044b\u0442\u0430\u0435\u043c \u043d\u0430 Object:<\/p>\n<pre><code class=\"java\">Arrays.stream(getDeclaredFields(Object.class)).forEach((f) -> {   System.out.println(f); });  \/\/ System.out: \/\/ private transient java.lang.Class java.lang.Object.shadow$_klass_ \/\/ private transient int java.lang.Object.shadow$_monitor_<\/code><\/pre>\n<p>\u0421\u043f\u0438\u0441\u043e\u043a \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u043d\u043e \u0437\u0430\u0442\u043e \u043a\u0430\u043a\u043e\u0439! \u042d\u0442\u0438 \u043f\u043e\u043b\u044f \u0435\u0441\u0442\u044c \u0443 \u043b\u044e\u0431\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0447\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445. \u042f \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b \u0438\u0445 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0431\u0443\u0434\u0443.<\/p>\n<p><strong>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u0432 \u043c\u0435\u0442\u043e\u0434<\/strong><\/p>\n<p>\u0412\u044b\u0448\u0435 \u0431\u044b\u043b\u043e \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e, \u0447\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043e\u0434\u043d\u043e \u0432 \u0434\u0440\u0443\u0433\u043e\u0435? \u0414\u0430! \u0412\u0441\u0435 \u043f\u043e\u043b\u044f \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 Executable, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442 \u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0418\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<\/p>\n<pre><code class=\"java\">public static Method convertConstructorToMethod(Constructor&lt;?> ct) {   \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434   Method out = allocateInstance(Method.class);    \/\/ \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u0435\u0433\u043e \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a ExecutableMirror   ExecutableMirror[] eb = arrayCast(ExecutableMirror.class, ct, out);    \/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f   eb[1].override = eb[0].override;   eb[1].accessFlags = eb[0].accessFlags;   eb[1].artMethod = eb[0].artMethod;   eb[1].hasRealParameterData = eb[0].hasRealParameterData;   eb[1].declaringClass = eb[0].declaringClass;   eb[1].dexMethodIndex = eb[0].dexMethodIndex;   eb[1].hasRealParameterData = eb[0].hasRealParameterData;   eb[1].parameters = eb[0].parameters;    return out; }<\/code><\/pre>\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u0438\u0441\u043f\u044b\u0442\u0430\u0435\u043c \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435<\/p>\n<pre><code class=\"java\">public class Test {   public Test() {} }  Constructor&lt;Test> c = nothrows_run(() -> Test.class.getDeclaredConstructor()); System.out.println(convertConstructorToMethod(c));  \/\/ System.out: public void Test.&lt;init>()<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0447\u0438\u0442\u0430\u044e\u0442 \u043b\u044e\u0434\u0438 \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0435 \u0441\u043e smali, \u0442\u043e \u043e\u043d\u0438 \u0434\u043e\u0433\u0430\u0434\u0430\u044e\u0442\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e. \u0412 \u0431\u0430\u0439\u0442\u043a\u043e\u0434\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043b\u0438\u0448\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c &#171;&lt;init>&#187; \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c final \u043f\u043e\u043b\u044f. \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0435\u0433\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u2014 void, \u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, \u0430 \u043b\u0438\u0448\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0433\u043e\u0442\u043e\u0432\u043e\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0441\u0430\u043c\u0438:<\/p>\n<pre><code class=\"java\">public class Test {   public Test() {     System.out.println(\"hello test\");   } }  Constructor&lt;Test> c = nothrows_run(() -> Test.class.getDeclaredConstructor()); Method m = convertConstructorToMethod(c); Test obj = allocateInstance(Test.class);  nothrows_run(() -> m.invoke(obj)); nothrows_run(() -> m.invoke(obj)); nothrows_run(() -> m.invoke(obj));  \/\/ System.out: \/\/ hello test \/\/ hello test \/\/ hello test<\/code><\/pre>\n<p>\u041d\u0430\u043c \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437! \u0410 \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f final \u043f\u043e\u043b\u0435?<\/p>\n<pre><code class=\"java\">public class Test {   private final double value;    public Test() {     value = Math.random();     System.out.println(value);   } }  &lt;...>  nothrows_run(() -> m.invoke(obj)); nothrows_run(() -> m.invoke(obj)); nothrows_run(() -> m.invoke(obj));  \/\/ System.out: \/\/ 0.9965129743657091 \/\/ 0.3030674376485418 \/\/ 0.46234661822536893<\/code><\/pre>\n<p>\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437. \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044f \u044d\u0442\u043e\u043c\u0443, \u0443\u0432\u044b, \u043d\u0435 \u043d\u0430\u0448\u0451\u043b.<\/p>\n<p><strong>\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440<\/strong><\/p>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u043a\u0430\u043a \u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0441 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c static? \u041f\u043e\u0440\u0430 \u0438\u0441\u043f\u044b\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0435\u0433\u043e \u043d\u0430\u0439\u0442\u0438:<\/p>\n<pre><code class=\"java\">Constructor&lt;?> getDeclaredStaticConstructor(Class&lt;?> clazz) {   Constructor[] out = Arrays.stream(getDeclaredExecutables0(clazz))     .filter((exec) -> exec instanceof Constructor     &amp;&amp; Modifier.isStatic(exec.getModifiers()))     .toArray(Constructor[]::new);   if (out.length == 0) {     return null;   }   return out[0]; }<\/code><\/pre>\n<p>\u041e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 newInstance, \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u043d\u0430 \u043d\u0451\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430. \u041d\u043e \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0435\u0441\u043b\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <strong>\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439<em> <\/em><\/strong>\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043d\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0435? \u0410 \u0432\u0435\u0434\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c newInstance<\/p>\n<pre><code class=\"java\">public class Test {    public int value = 100500;    static {     System.out.println(\"hello test\");   } }  Constructor&lt;Test> c = getDeclaredStaticConstructor(Test.class); Test obj = nothrows_run(() -> c.newInstance()); System.out.println(obj.value);  \/\/ System.out: \/\/ hello test \/\/ hello test \/\/ 0<\/code><\/pre>\n<p>\u0412\u0441\u0451 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0432\u044b\u0437\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430, \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u044d\u0442\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 &#171;hello test&#187;, \u0437\u0430\u0442\u0435\u043c \u0431\u044b\u043b \u0432\u044b\u0434\u0435\u043b\u0435\u043d \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437 \u0432\u044b\u0437\u0432\u0430\u043b\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043e\u043d \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u043b \u0435\u0449\u0451 \u043e\u0434\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 &#171;hello test&#187;, \u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432\u0435\u0440\u043d\u0443\u043b\u0441\u044f \u043d\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c, \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0435\u0433\u043e \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u043b. \u042d\u0442\u043e \u0432\u0438\u0434\u043d\u043e \u043f\u043e \u043d\u0443\u043b\u0435\u0432\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0432\u044b\u0432\u0435\u043b\u0438 \u043f\u043e\u0437\u0436\u0435. \u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0448\u0430\u0433 \u2014 \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0432 \u043c\u0435\u0442\u043e\u0434 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435:<\/p>\n<pre><code class=\"java\">public class Test {    public int value = 100500;    static {     System.out.println(\"hello test\");   } }  Constructor&lt;Test> c = getDeclaredStaticConstructor(Test.class); Method m = convertConstructorToMethod(c); System.out.println(m); nothrows_run(() -> m.invoke(null));  \/\/ System.out: \/\/ static void Test.&lt;clinit>() \/\/ hello test \/\/ hello test<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u043c, \u043d\u043e \u043f\u043e \u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f 2 \u0440\u0430\u0437\u0430. \u0410 \u0438\u043c\u044f \u0441\u043d\u043e\u0432\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u0437\u043d\u0430\u0442\u043e\u043a\u0430\u043c smali \u2014 &#171;&lt;clinit>&#187;. \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a \u043a\u043e\u043d\u0446\u0443.<\/p>\n<p>\u0412\u0435\u0441\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438\u00a0<a href=\"https:\/\/github.com\/vova7878\/AndroidUnsafe\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/721054\/\"> https:\/\/habr.com\/ru\/post\/721054\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u043a\u043b\u0430\u0441\u0441\u0430\u0445-\u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0430\u0445 \u0432 ART \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u043e\u043b\u0435\u0439, \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u0432 \u043c\u0435\u0442\u043e\u0434 \u0438 \u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0435 \u043d\u0430 \u0433\u043e\u0442\u043e\u0432\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435.<\/p>\n<figure class=\"full-width\"><\/figure>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/habr.com\/ru\/post\/720788\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 1<\/a>. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 arrayCast \u0438 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435.<\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/721054\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 2<\/a>. \u041a\u043b\u0430\u0441\u0441\u044b-\u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0438. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439, \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u0432 \u043c\u0435\u0442\u043e\u0434\u044b. \u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440.<\/p>\n<\/div>\n<\/details>\n<p><strong>\u041a\u043b\u0430\u0441\u0441\u044b-\u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0438<\/strong><\/p>\n<p>\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441 arrayCast`\u043e\u043c \u2014 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u0430\u043a \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0434\u0440\u0443\u0433\u043e\u0439. \u0412 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043b\u0435\u0436\u0438\u0442 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 &#8212; \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u0439\u0442\u043e\u0432, \u0438 \u043a\u0430\u043a \u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043b\u0438\u0448\u044c \u043e\u0442 \u043d\u0430\u0441. \u042d\u0442\u0438\u043c \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0430\u043d\u0434\u0440\u043e\u0438\u0434\u0430, \u0445\u0440\u0430\u043d\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u0430\u043a \u0432\u0438\u0434\u043e\u0438\u0437\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0430 MirrorType \u2014 \u043a\u043b\u0430\u0441\u0441\u044b-\u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u044f\u0437\u044b\u043a\u0430 C++ \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438 (\u0447\u0442\u043e\u0431\u044b \u043c\u0430\u043a\u0435\u0442\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u043b\u0438 \u043c\u0435\u0436\u0434\u0443 \u044f\u0437\u044b\u043a\u0430\u043c\u0438).<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0434\u0432\u043e\u0439\u043d\u0438\u043a\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/android.googlesource.com\/platform\/art\/+\/refs\/heads\/master\/runtime\/mirror\/object.h\" rel=\"noopener noreferrer nofollow\">object.h<\/a><\/p>\n<pre><code class=\"cpp\">\/\/ C++ mirror of java.lang.Object class MANAGED LOCKABLE Object {   &lt;...>   \/\/ The Class representing the type of the object.   HeapReference&lt;Class> klass_;   \/\/ Monitor and hash code information.   uint32_t monitor_;   &lt;...> };<\/code><\/pre>\n<p><a href=\"https:\/\/android.googlesource.com\/platform\/art\/+\/refs\/heads\/master\/runtime\/mirror\/throwable.h\" rel=\"noopener noreferrer nofollow\">throwable.h<\/a><\/p>\n<pre><code class=\"cpp\">\/\/ C++ mirror of java.lang.Throwable class MANAGED Throwable : public Object {   &lt;...>   HeapReference&lt;Object> backtrace_;   HeapReference&lt;Throwable> cause_;   HeapReference&lt;String> detail_message_;   HeapReference&lt;Object> stack_trace_;   HeapReference&lt;Object> suppressed_exceptions_;   &lt;...> };<\/code><\/pre>\n<p><a href=\"https:\/\/android.googlesource.com\/platform\/art\/+\/refs\/heads\/master\/runtime\/mirror\/string.h\" rel=\"noopener noreferrer nofollow\">string.h<\/a><\/p>\n<pre><code class=\"cpp\">\/\/ C++ mirror of java.lang.String class MANAGED String final : public Object {   &lt;...>   \/\/ If string compression is enabled, count_ holds the StringCompressionFlag in the   \/\/ least significant bit and the length in the remaining bits, length = count_ >> 1.   int32_t count_;   uint32_t hash_code_;   \/\/ Compression of all-ASCII into 8-bit memory leads to usage one of these fields   union {     uint16_t value_[0];     uint8_t value_compressed_[0];   };   &lt;...> };<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043f\u043e\u043b\u0435\u0439 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 java \u0438 c++ \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430\u043c\u0438 \u0440\u0430\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u043e\u043b\u0435\u0439 \u0432 \u044d\u0442\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445. \u0427\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 &#171;ValidateFieldOrderOfJavaCppUnionClasses&#187; \u2014 \u0440\u044f\u0434 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043a\u043b\u0430\u0441\u0441\u044b-\u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0438 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 java, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u044b \u0437\u0430\u0440\u0430\u043d\u0435\u0435. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u2014 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u0442\u0438\u043f\u0430\u043c\u0438 \u0438 \u0438\u043c\u0435\u043d\u0430\u043c\u0438, \u0447\u0442\u043e \u0438 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443.<\/p>\n<p><strong>\u0417\u0430\u043b\u0435\u0437\u0430\u0435\u043c \u0432 \u043a\u043b\u0430\u0441\u0441<\/strong><\/p>\n<p>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u0412\u0441\u0435 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u044e\u0442 android 8.0+ \u0438 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445. \u0412\u0435\u0440\u0445\u043d\u0435\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043d\u043e \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u0441 android 14 DP2 \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u043e\u0439\u043d\u0438\u043a\u043e\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043a\u043b\u0430\u0441\u0441\u044b-\u0434\u0432\u043e\u0439\u043d\u0438\u043a\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">public class ClassMirror {   public ClassLoader classLoader;   public Class&lt;?> componentType;   public Object dexCache;   public Object extData;   public Object[] ifTable;   public String name;   public Class&lt;?> superClass;   public Object vtable;   public long iFields;   public long methods;   public long sFields;   public int accessFlags;   public int classFlags;   public int classSize;   public int clinitThreadId;   public int dexClassDefIndex;   public volatile int dexTypeIndex;   public int numReferenceInstanceFields;   public int numReferenceStaticFields;   public int objectSize;   public int objectSizeAllocFastPath;   public int primitiveType;   public int referenceInstanceOffsets;   public int status;   public short copiedMethodsOffset;   public short virtualMethodsOffset; }  public class AccessibleObjectMirror {   public boolean override; }  public class FieldMirror extends AccessibleObjectMirror {   public int accessFlags;   public Class&lt;?> declaringClass;   public int artFieldIndex;   public int offset;   public Class&lt;?> type; }  public class ExecutableMirror extends AccessibleObjectMirror {   public volatile boolean hasRealParameterData;   public volatile Parameter[] parameters;   public int accessFlags;   public long artMethod;   public Class&lt;?> declaringClass;   public Class&lt;?> declaringClassOfOverriddenMethod;   public int dexMethodIndex; }  public class MethodHandleMirror {   public MethodType type;   \/\/ \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u043b\u0435 \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438,   \/\/ \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0440\u0443\u0448\u0435\u043d,   \/\/ \u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043d\u0435 \u0432\u0430\u0436\u043d\u043e, \u0442.\u043a.   \/\/ \u043c\u044b \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u044d\u0442\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043a \"\u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0435\u043c\"   public Object different;   public MethodHandleImplMirror cachedSpreadInvoker;   public int handleKind;   public long artFieldOrMethod; }  public class MethodHandleImplMirror extends MethodHandleMirror {   public HandleInfoMirror info; }  public class HandleInfoMirror {   public Member member;   public MethodHandleImplMirror handle; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u043b\u044f iFields, sFields \u0438 methods \u0432 ClassMirror \u2014 \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u0442\u0438\u043f long, \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 C++ \u043a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/android.googlesource.com\/platform\/art\/+\/refs\/heads\/master\/libartbase\/base\/length_prefixed_array.h\" rel=\"noopener noreferrer nofollow\">LengthPrefixedArray<\/a>.<\/p>\n<pre><code class=\"cpp\">template&lt;typename T> class LengthPrefixedArray {   &lt;...>   uint32_t size_;   uint8_t data_[0];   &lt;...> };<\/code><\/pre>\n<p>\u0417\u0430\u043c\u0435\u0442\u043a\u0430: \u0410\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 32 \u0438\u043b\u0438 64 \u0431\u0438\u0442, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u043d\u043e \u0432\u0441\u0435 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b java \u0438\u043c\u0435\u044e\u0442 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u0442, \u0447\u0442\u043e \u0432\u043c\u0435\u0449\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435. \u041d\u0430 32-\u0431\u0438\u0442\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0447\u0438\u0441\u043b\u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u2014 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u044d\u043a\u043e\u043d\u043e\u043c\u043d\u043e, \u0437\u0430\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>\u0412 iFields \u0438 sFields \u044d\u0442\u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0445\u0440\u0430\u043d\u0438\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b <a href=\"https:\/\/android.googlesource.com\/platform\/art\/+\/refs\/heads\/master\/runtime\/art_field.h\" rel=\"noopener noreferrer nofollow\">ArtField<\/a>, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u0435. \u041f\u0440\u0435\u0444\u0438\u043a\u0441 s \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u043b\u044f, i \u2014 \u043f\u043e\u043b\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430. \u0412 methods \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f <a href=\"https:\/\/android.googlesource.com\/platform\/art\/+\/refs\/heads\/master\/runtime\/art_method.h\" rel=\"noopener noreferrer nofollow\">ArtMethod<\/a>`\u044b, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b (\u0414\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0435, \u0432\u0435\u0434\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043c\u0435\u0442\u043e\u0434 \u0441\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c. \u041f\u043e\u0437\u0436\u0435 \u044d\u0442\u043e \u0437\u043d\u0430\u043d\u0438\u0435 \u043d\u0430\u043c \u0435\u0449\u0451 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f). \u0418\u0437 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u044d\u0442\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0430\u043d\u0434\u0440\u043e\u0438\u0434 \u0443\u043c\u0435\u0435\u0442 &#171;\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c&#187; \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b Field, Method \u0438 Constructor \u2014 \u0430 \u0432\u0435\u0434\u044c \u044d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e!<\/p>\n<p><strong>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430, \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0440\u043e\u0441\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439, \u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0432 \u043b\u044f\u043c\u0431\u0434\u0443 \u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441 throwException \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438<\/p>\n<details class=\"spoiler\">\n<summary>\u041e\u0431\u0451\u0440\u0442\u043a\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">@FunctionalInterface public interface TRun&lt;T> {   public T run() throws Throwable; }  public static &lt;T> T nothrows_run(TRun&lt;T> r) {   try {     return r.run();   } catch (Throwable th) {     Thrower.throwException(th);     throw new RuntimeException(th);   } }  \/\/ void \u0432\u0435\u0440\u0441\u0438\u044f @FunctionalInterface public interface VTRun {   public void run() throws Throwable; }  public static void nothrows_run(VTRun r) {   try {     r.run();   } catch (Throwable th) {     Thrower.throwException(th);     throw new RuntimeException(th);   } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 Executable<\/strong><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e LengthPrefixedArray, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u0447\u0430\u043b\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u0442\u0441\u0442\u0443\u043f \u0434\u043b\u044f \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cpp\">static size_t OffsetOfElement(size_t index,                               size_t element_size = sizeof(T),                               size_t alignment = alignof(T)) {   DCHECK_ALIGNED_PARAM(element_size, alignment);   \/\/ \u041e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0434\u043e \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f   return RoundUp(offsetof(LengthPrefixedArray&lt;T>, data_), alignment) + index * element_size; }<\/code><\/pre>\n<p>\u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430 java, \u043d\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c \u043d\u0438 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435, \u043d\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435.<\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u0434\u043b\u044f \u043d\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0430 Executable. \u041e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0438 \u0432\u0441\u0435 \u043f\u043e\u043b\u044f. \u041e\u0434\u043d\u043e \u0438\u0437 \u043d\u0438\u0445 \u2014 artMethod \u2014 \u044d\u0442\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0443\u044e \u043d\u0430\u0441 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. \u041f\u043e \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0432 \u0434\u0432\u0443\u0445 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"java\">public class ArtMethod_Test {    public static final Method method_a =     nothrows_run(() -> Test.class.getDeclaredMethod(\"a\"));   public static final Method method_b =     nothrows_run(() -> Test.class.getDeclaredMethod(\"b\"));      public static void a() {}   public static void b() {} }  long getArtMethod(Executable ex) {   \/\/ \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u043c ex \u043a \u0442\u0438\u043f\u0443 ExecutableMirror   ExecutableMirror[] mirror = arrayCast(ExecutableMirror.class, ex);   return mirror[0].artMethod; }  \/\/ \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u043c ArtMethod_Test.class \u043a \u0442\u0438\u043f\u0443 ClassMirror ClassMirror[] test = arrayCast(ClassMirror.class, ArtMethod_Test.class);  long am = getArtMethod(ArtMethod_Test.method_a); long bm = getArtMethod(ArtMethod_Test.method_b);  \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u043a\u0430\u0436\u0434\u043e\u0433\u043e ArtMethod int artMethodSize = (int) (bm - am);  \/\/ \u0420\u0430\u0437\u043c\u0435\u0440 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445 uint32_t \u043f\u043e\u043b\u044f size_ \u0432 LengthPrefixedArray final int size_field_length = 4;  \/\/ \u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e ArtMethod int artMethodPadding = (int) (am - test[0].methods - size_field_length)   % artMethodSize + size_field_length;<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0441\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0441\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0430 \u0432\u0441\u0435 \u0435\u0433\u043e Executable<\/p>\n<pre><code class=\"java\">\/\/ \u041a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u0430\u043b\u0435\u0435 static final Class&lt;MethodHandle> MethodHandleImplClass = nothrows_run(() -> {   return (Class&lt;MethodHandle>) Class.forName(\"java.lang.invoke.MethodHandleImpl\"); });  Executable[] getDeclaredExecutables0(Class&lt;?> clazz) {   Objects.requireNonNull(clazz);    \/\/ \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 \u043a ClassMirror   ClassMirror[] clazz_mirror = arrayCast(ClassMirror.class, clazz);   long methods = clazz_mirror[0].methods;    \/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0440\u0430\u0432\u0435\u043d 0, \u0437\u0434\u0435\u0441\u044c \u043f\u0443\u0441\u0442\u043e   if (methods == 0) {     return new Executable[0];   }    \/\/ \u0427\u0438\u0442\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e   int col = getInt(methods);   Executable[] out = new Executable[col];   if (out.length == 0) {     return out;   }    \/\/ \u042d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0443\u043c\u0435\u0435\u0442 \"\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c\" Executable \u0438 Field   MethodHandle mh = allocateInstance(MethodHandleImplClass);   MethodHandleImplMirror[] mhm = arrayCast(MethodHandleImplMirror.class, mh);      for (int i = 0; i &lt; col; i++) {     \/\/ \u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u043d\u0430\u0448 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c     mhm[0].artFieldOrMethod = methods + artMethodPadding + artMethodSize * i;     \/\/ \u041e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \"\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\"     mhm[0].info = null;     \/\/<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-346580","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=346580"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346580\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=346580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=346580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=346580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}