def load_array_class(self, name): clazz = Class() clazz.access_flags = AccessFlags.ACC_PUBLIC clazz.name = name clazz.loader = self # 数组类不需要初始化,把init_started字段设置成True clazz.init_started = True # 数组类的超类是java.lang.Object clazz.super_class = self.load_class("java/lang/Object") # 并实现了java.lang.Cloneable和java.io.Serializable接口 clazz.interfaces = [self.load_class("java/lang/Cloneable"), self.load_class("java/io/Serializable")] self.class_map[name] = clazz return clazz
def resolve_super_class(clazz: Class): if clazz.name != "java/lang/object" and clazz.super_class_name: clazz.super_class = clazz.loader.load_class(clazz.super_class_name)