diff --git a/README.md b/README.md index 8af3968..8528c53 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Quick overview -------------- ```python ->>> from jnius import autoclass +>>> from jnius.reflect import autoclass >>> autoclass('java.lang.System').out.println('Hello world') Hello world diff --git a/jnius/jnius.pyx b/jnius/jnius.pyx index 9190746..0b368b9 100644 --- a/jnius/jnius.pyx +++ b/jnius/jnius.pyx @@ -623,7 +623,7 @@ cdef class JavaMethod(object): self.definition) if self.j_method == NULL: - raise JavaException('Unable to found the method' + raise JavaException('Unable to find the method' ' {0}({1})'.format(self.name, self.definition)) cdef void set_resolve_info(self, JNIEnv *j_env, jclass j_cls, diff --git a/jnius/reflect.py b/jnius/reflect.py index e5c2099..e5c3d6c 100644 --- a/jnius/reflect.py +++ b/jnius/reflect.py @@ -9,6 +9,8 @@ class Class(JavaClass): forName = JavaStaticMethod('(Ljava/lang/String;)Ljava/lang/Class;') getConstructors = JavaMethod('()[Ljava/lang/reflect/Constructor;') + getMethods = JavaMethod('()[Ljava/lang/reflect/Method;') + getFields = JavaMethod('()[Ljava/lang/reflect/Field;') getDeclaredMethods = JavaMethod('()[Ljava/lang/reflect/Method;') getDeclaredFields = JavaMethod('()[Ljava/lang/reflect/Field;') getName = JavaMethod('()Ljava/lang/String;') @@ -112,7 +114,7 @@ def autoclass(clsname): constructors.append(sig) classDict['__javaconstructor__'] = constructors - methods = c.getDeclaredMethods() + methods = c.getMethods() methods_name = [x.getName() for x in methods] for index, method in enumerate(methods): name = methods_name[index] @@ -159,7 +161,7 @@ def autoclass(clsname): classDict[name] = JavaMethodMultiple(signatures) - for field in c.getDeclaredFields(): + for field in c.getFields(): static = Modifier.isStatic(field.getModifiers()) sig = get_signature(field.getType()) cls = JavaStaticField if static else JavaField