DevBoost / EMFText

EMFText is an Eclipse plug-in that allows you to define text syntax for languages described by an Ecore metamodel. EMFText enables developers to define textual Domain Specific Languages quickly and without the need to learn new technologies and concepts.
14 stars 12 forks source link

Printer closes its stream and Printer2 does not #37

Closed jreimone closed 11 years ago

jreimone commented 11 years ago

Both printers create a PrintWriter in their print(EObject element) methods. While the Printer2 only flushes the writer, Printer even closes it. This results in some strange behaviour in one of my test cases where some EObject's should be printed to console. Thus, I tried out the following:

1) RolemappingPrinter2 printer = new RolemappingPrinter2(System.out, null); 2) RolemappingPrinter printer = new RolemappingPrinter(System.out, null);

In the first case (where the writer isn't closed) each call to print(EObject element) causes the expected result. In the second case (whre the writer is closed), only the first call print(EObject element) works. After that nothing is printed to the console anymore. Nor, normal calls to System.out.println("something").

So what I'm asking is, is this an EMFText/Printer problem or is this my fault because of passing System.out as printer which is not intended?

mirkoseifert commented 11 years ago

The Printer(1) is deprecated anyways. Feel free to modify the code generator and remove the call to close().

jreimone commented 11 years ago

fixed in commit e893ec6

mirkoseifert commented 11 years ago

Thanks!