From 389cdae3eccbe35a8fc18c30b623b14dd62cbf90 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Mon, 23 Jul 2018 19:16:05 +0200 Subject: [PATCH] Extend abstract types --- .../github/lonamiwebs/overgram/generator/Generator.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/lonamiwebs/overgram/generator/Generator.java b/src/main/java/io/github/lonamiwebs/overgram/generator/Generator.java index c5b0304..c4aa8c8 100644 --- a/src/main/java/io/github/lonamiwebs/overgram/generator/Generator.java +++ b/src/main/java/io/github/lonamiwebs/overgram/generator/Generator.java @@ -18,7 +18,7 @@ public class Generator { writeAbstract(writer, types); } try (final Writer writer = new BufferedWriter(new FileWriter(typesFile))) { - writeCode(writer, "Types", "TLObject", types); + writeCode(writer, "Types", null, types); } try (final Writer writer = new BufferedWriter(new FileWriter(functionsFile))) { writeCode(writer, "Functions", "TLRequest", functions); @@ -68,7 +68,12 @@ public class Generator { writer.write("public static class "); writer.write(TLObject.toCamelCase(object.name)); writer.write(" extends "); - writer.write(extendsName); + if (extendsName == null) { + writer.write("Abstract."); + writer.write(TLObject.toCamelCase(object.type)); + } else { + writer.write(extendsName); + } writer.write(" {\n"); for (int i = 0; i < object.args.size(); ++i) {