javaclass

Changeset

62:be1a46eda340
2004-11-19 Paul Boddie raw files shortlog changelog graph Introduced class initialisation avoidance for abstract classes (although this needs further investigation).
classhook.py (file)
     1.1 --- a/classhook.py	Fri Nov 19 15:45:02 2004 +0100
     1.2 +++ b/classhook.py	Fri Nov 19 15:45:33 2004 +0100
     1.3 @@ -153,13 +153,14 @@
     1.4              translator = bytecode.ClassTranslator(class_file)
     1.5              cls = translator.process(global_names)
     1.6              module.__dict__[cls.__name__] = cls
     1.7 -            classes.append(cls)
     1.8 +            classes.append((cls, class_file))
     1.9  
    1.10          # Finally, call __clinit__ methods for all relevant classes.
    1.11  
    1.12 -        for cls in classes:
    1.13 -            if hasattr(cls, "__clinit__"):
    1.14 -                cls.__clinit__()
    1.15 +        for cls, class_file in classes:
    1.16 +            if not classfile.has_flags(class_file.access_flags, [classfile.ABSTRACT]):
    1.17 +                if hasattr(cls, "__clinit__"):
    1.18 +                    cls.__clinit__()
    1.19  
    1.20          return module
    1.21