summaryrefslogtreecommitdiff
path: root/plugins/dex
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-05-07 15:57:38 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-05-07 15:57:38 (GMT)
commit14a2c6dab00ab8ffff4c37b6d088d332bc6abd6c (patch)
tree8cec7da41a5c7b728dc3d796ebdac0b85ff46a9d /plugins/dex
parent998f0697355ddfb17c5828c3ef236a5c795ee191 (diff)
Kept methods of annotated classes during loading.
Diffstat (limited to 'plugins/dex')
-rw-r--r--plugins/dex/class.c5
-rw-r--r--plugins/dex/method.c9
-rw-r--r--plugins/dex/python/method.c9
3 files changed, 16 insertions, 7 deletions
diff --git a/plugins/dex/class.c b/plugins/dex/class.c
index fded32c..a674b98 100644
--- a/plugins/dex/class.c
+++ b/plugins/dex/class.c
@@ -290,11 +290,6 @@ GDexClass *g_dex_class_new(GDexFormat *format, const class_def_item *def)
* Chargement des méthodes de classe.
*/
- /**
- * On évite ici les méthodes (virtuelles) non définies.
- */
- if (def->access_flags & ACC_ANNOTATION) goto gdcn_done;
-
ctype = get_type_from_dex_pool(format, def->class_idx);
if (ctype == NULL) goto gdcn_unknown_type;
diff --git a/plugins/dex/method.c b/plugins/dex/method.c
index 4013436..5b7b30e 100644
--- a/plugins/dex/method.c
+++ b/plugins/dex/method.c
@@ -24,6 +24,7 @@
#include "method.h"
+#include <assert.h>
#include <stddef.h>
#include <string.h>
@@ -43,7 +44,11 @@ struct _GDexMethod
GBinRoutine *routine; /* Représentation interne */
- /* FIXME : méthode interne seulement */
+ /**
+ * Les champs suivants ne sont renseignés que pour les objets mis
+ * en place à partir du constructeur g_dex_method_new_defined().
+ */
+
encoded_method info; /* Propriétés de la méthode */
bool has_body; /* Indication de présence */
code_item body; /* Corps de la méthode */
@@ -439,6 +444,8 @@ DexVariableIndex g_dex_method_get_variable(const GDexMethod *method, uint32_t in
const code_item *body; /* Corps de la méthode */
uint32_t pivot; /* Bascule pour les arguments */
+ assert(method->has_body);
+
info = &method->info;
body = &method->body;
diff --git a/plugins/dex/python/method.c b/plugins/dex/python/method.c
index 4f35e1a..5a06403 100644
--- a/plugins/dex/python/method.c
+++ b/plugins/dex/python/method.c
@@ -100,7 +100,14 @@ static PyObject *py_dex_method_get_code_item(PyObject *self, void *closure)
body = g_dex_method_get_dex_body(method);
- result = translate_dex_method_body_to_python(body);
+ if (body == NULL)
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ else
+ result = translate_dex_method_body_to_python(body);
return result;