diff --git a/src/ch/akuhn/fame/codegen/GenFile.java b/src/ch/akuhn/fame/codegen/GenFile.java index fd21ea5..d597201 100644 --- a/src/ch/akuhn/fame/codegen/GenFile.java +++ b/src/ch/akuhn/fame/codegen/GenFile.java @@ -37,10 +37,15 @@ public void addImport(String aPackage, String className) { imports.add(aPackage + "." + className); } - public void addSuperclass(String aPackage, String className) { - if (className.equals("Object") && aPackage.equals("java.lang")) return; - this.addImport(aPackage, className); - this.superName = className; + public void addSuperclass(String packageName, String superClassName) { + if (superClassName.equals("Object") && packageName.equals("java.lang")) return; + + if (this.name.equals(superClassName)) { + this.superName = packageName + "." + superClassName; + } else { + this.addImport(packageName, superClassName); + this.superName = superClassName; + } } public abstract void generateCode(Appendable stream) throws IOException;