X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/c9c16dde5f5c8469610e727748875806a29906a6..80fe26a61e165b7456274d6cc52ae40cb53b5c13:/Java/Cycript.java?ds=sidebyside diff --git a/Java/Cycript.java b/Java/Cycript.java index d234956..79ebe8e 100644 --- a/Java/Cycript.java +++ b/Java/Cycript.java @@ -1,5 +1,5 @@ -/* Cycript - Optimizing JavaScript Compiler/Runtime - * Copyright (C) 2009-2015 Jay Freeman (saurik) +/* Cycript - The Truly Universal Scripting Language + * Copyright (C) 2009-2016 Jay Freeman (saurik) */ /* GNU Affero General Public License, Version 3 {{{ */ @@ -43,6 +43,7 @@ public static native Object handle(long protect, String property, Object[] argum throws Throwable; public static class Wrapper + extends RuntimeException implements InvocationHandler { private long protect_; @@ -61,6 +62,18 @@ public static class Wrapper return protect_; } + public Object call(String property, Object[] arguments) { + try { + return handle(protect_, property, arguments); + } catch (Throwable throwable) { + return new RuntimeException(throwable); + } + } + + public String toString() { + return call("toString", null).toString(); + } + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {