eclipsextextxtend

Xtend - saved files contain repeated data


I don't know why when I generate files fsa.generateFile(fileName, finalString) it creates the files fine, but when I clean the project, it doubles the output.

Even if I delete the file, it continues growing.

Is this a code or Eclipse problem?

Thank you.


Solution

  • you store the file content for some reason as a member in the generator and never reset it

    val root = resource?.allContents?.head as ProblemSpecification;
    s += readFile(path_sigAlloyDeclaration+"sigAlloyDeclaration.txt")
    

    i assume s either should be local to the doGenerate method or be reset at the start

    s = ""
    val root = resource?.allContents?.head as ProblemSpecification;
    s += readFile(path_sigAlloyDeclaration+"sigAlloyDeclaration.txt")