fix: don't change annotated code on finish (#1732)

Remove first empty line break annotation positions, can occur for classes in default package
This commit is contained in:
Skylot
2023-06-02 21:41:38 +01:00
parent 76e5824d99
commit e9a7ccd00c
2 changed files with 4 additions and 3 deletions
@@ -154,7 +154,6 @@ public class AnnotatedCodeWriter extends SimpleCodeWriter implements ICodeWriter
@Override
public ICodeInfo finish() {
removeFirstEmptyLine();
processDefinitionAnnotations();
validateAnnotations();
String code = buf.toString();
@@ -100,10 +100,12 @@ public class ClassGen {
addClassCode(clsBody);
ICodeWriter clsCode = cls.root().makeCodeWriter();
if (!"".equals(cls.getPackage())) {
if (cls.getPackage().isEmpty()) {
clsCode.add("// default package");
} else {
clsCode.add("package ").add(cls.getPackage()).add(';');
clsCode.newLine();
}
clsCode.newLine();
int importsCount = imports.size();
if (importsCount != 0) {
List<ClassInfo> sortedImports = new ArrayList<>(imports);