javaclass

Changeset

164:f83c8a6dd935
2005-01-27 Paul Boddie raw files shortlog changelog graph Improved exceptions when classes cannot be imported. Changed the definition of the "wide" bytecode method to just raise an exception. rel-0-1
javaclass/bytecode.py (file)
     1.1 --- a/javaclass/bytecode.py	Thu Jan 27 23:30:38 2005 +0100
     1.2 +++ b/javaclass/bytecode.py	Thu Jan 27 23:31:52 2005 +0100
     1.3 @@ -2007,7 +2007,7 @@
     1.4  
     1.5      def wide(self, code, program):
     1.6          # NOTE: To be implemented.
     1.7 -        return number_of_arguments
     1.8 +        raise NotImplementedError, "wide"
     1.9  
    1.10  def disassemble(class_file, method):
    1.11      disassembler = BytecodeDisassembler(class_file)
    1.12 @@ -2340,7 +2340,10 @@
    1.13              obj = __import__(super_class_module_name, global_names, {}, [])
    1.14              for super_class_name_part in super_class_name_parts[1:] or [super_class_name]:
    1.15                  #print "*", obj, super_class_name_part
    1.16 -                obj = getattr(obj, super_class_name_part)
    1.17 +                try:
    1.18 +                    obj = getattr(obj, super_class_name_part)
    1.19 +                except AttributeError:
    1.20 +                    raise AttributeError, "Cannot find class '%s' in Java package '%s'" % (super_class_name_part, super_class_module_name)
    1.21          return (obj,)
    1.22  
    1.23      def make_varnames(self, nlocals, method_is_static=0):