paul@113 | 1 | #!/usr/bin/env python |
paul@113 | 2 | |
paul@113 | 3 | "Special module used to avoid circular imports." |
paul@113 | 4 | |
paul@113 | 5 | class Object(object): |
paul@113 | 6 | def getClass(self): |
paul@113 | 7 | import java.lang.reflect |
paul@113 | 8 | return java.lang.reflect.Class(self) |
paul@113 | 9 | getClass___ = getClass |
paul@113 | 10 | |
paul@113 | 11 | # NOTE: Establish a better exception hierarchy. |
paul@113 | 12 | |
paul@113 | 13 | class Error(Object): |
paul@113 | 14 | def __init__(self, *args): |
paul@113 | 15 | self.args = args |
paul@113 | 16 | |
paul@113 | 17 | setattr(Error, "__init_____", Error.__init__) |
paul@113 | 18 | setattr(Error, "__init_____java__lang__String", Error.__init__) |
paul@113 | 19 | |
paul@113 | 20 | class Exception(Object): |
paul@113 | 21 | def __init__(self, *args): |
paul@113 | 22 | self.args = args |
paul@113 | 23 | |
paul@113 | 24 | setattr(Exception, "__init_____", Exception.__init__) |
paul@113 | 25 | setattr(Exception, "__init_____java__lang__String", Exception.__init__) |
paul@113 | 26 | |
paul@113 | 27 | class IndexOutOfBoundsException(Exception): |
paul@113 | 28 | pass |
paul@113 | 29 | |
paul@113 | 30 | setattr(IndexOutOfBoundsException, "__init_____", IndexOutOfBoundsException.__init__) |
paul@113 | 31 | setattr(IndexOutOfBoundsException, "__init_____java__lang__String", IndexOutOfBoundsException.__init__) |
paul@113 | 32 | |
paul@113 | 33 | class IllegalArgumentException(Exception): |
paul@113 | 34 | pass |
paul@113 | 35 | |
paul@113 | 36 | setattr(IllegalArgumentException, "__init_____", IllegalArgumentException.__init__) |
paul@113 | 37 | setattr(IllegalArgumentException, "__init_____java__lang__String", IllegalArgumentException.__init__) |
paul@113 | 38 | |
paul@113 | 39 | class NoSuchMethodException(Exception): |
paul@113 | 40 | pass |
paul@113 | 41 | |
paul@113 | 42 | setattr(NoSuchMethodException, "__init_____", NoSuchMethodException.__init__) |
paul@113 | 43 | setattr(NoSuchMethodException, "__init_____java__lang__String", NoSuchMethodException.__init__) |
paul@113 | 44 | |
paul@113 | 45 | class NullPointerException(Exception): |
paul@113 | 46 | pass |
paul@113 | 47 | |
paul@113 | 48 | setattr(NullPointerException, "__init_____", NullPointerException.__init__) |
paul@113 | 49 | setattr(NullPointerException, "__init_____java__lang__String", NullPointerException.__init__) |
paul@113 | 50 | |
paul@113 | 51 | class SecurityException(Exception): |
paul@113 | 52 | pass |
paul@113 | 53 | |
paul@113 | 54 | setattr(SecurityException, "__init_____", SecurityException.__init__) |
paul@113 | 55 | setattr(SecurityException, "__init_____java__lang__String", SecurityException.__init__) |
paul@113 | 56 | |
paul@113 | 57 | # vim: tabstop=4 expandtab shiftwidth=4 |