From dde3cb3b99d83b1e0cf9691f91aa1d6bfa61f808 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Mon, 16 Nov 2020 04:30:45 +0000 Subject: [PATCH] java: workaround handling of base class --- modules/java/generator/gen_java.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/java/generator/gen_java.py b/modules/java/generator/gen_java.py index 6c604ed..e411175 100755 --- a/modules/java/generator/gen_java.py +++ b/modules/java/generator/gen_java.py @@ -272,8 +272,16 @@ class ClassInfo(GeneralInfo): self.base = '' if decl[1]: - #self.base = re.sub(r"\b"+self.jname+r"\b", "", decl[1].replace(":", "")).strip() - self.base = re.sub(r"^.*:", "", decl[1].split(",")[0]).strip().replace(self.jname, "") + # FIXIT Use generator to find type properly instead of hacks below + base_class = re.sub(r"^: ", "", decl[1]) + base_class = re.sub(r"^cv::", "", base_class) + base_class = base_class.replace('::', '.') + base_info = ClassInfo(('class {}'.format(base_class), '', [], [], None, None), [self.namespace]) + base_type_name = base_info.name + if not base_type_name in type_dict: + base_type_name = re.sub(r"^.*:", "", decl[1].split(",")[0]).strip().replace(self.jname, "") + self.base = base_type_name + self.addImports(self.base) def __repr__(self): return Template("CLASS $namespace::$classpath.$name : $base").substitute(**self.__dict__) -- 2.7.4