From 835c3b1b6f76fff29290949cc14cad2a2b26b265 Mon Sep 17 00:00:00 2001 From: Eugene Petrenko Date: Sun, 23 Sep 2018 15:49:11 +0200 Subject: less noise from an attempt to write file several times --- core/src/main/kotlin/Generation/FileGenerator.kt | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'core/src') diff --git a/core/src/main/kotlin/Generation/FileGenerator.kt b/core/src/main/kotlin/Generation/FileGenerator.kt index 8a282ef1..c90d0735 100644 --- a/core/src/main/kotlin/Generation/FileGenerator.kt +++ b/core/src/main/kotlin/Generation/FileGenerator.kt @@ -25,27 +25,11 @@ class FileGenerator @Inject constructor(@Named("outputDir") override val root: F //TODO: it opens the way to safely track all files created //TODO: to make sure no files were overwritten by mistake //TODO: also, the NodeLocationAwareGenerator should be removed - val stack = "$context\n" + try { - throw Error() - } catch (t: Throwable) { - StringWriter().use { ww -> - PrintWriter(ww).use { - t.printStackTrace(it) - } - ww.toString().split("[\r\n]+").asSequence().drop(1).take(3).joinToString("\n") {" $it"} - } - } - val writes = createdFiles.getOrDefault(this, listOf()) + stack + val writes = createdFiles.getOrDefault(this, listOf()) + context createdFiles[this] = writes if (writes.size > 1) { println("ERROR. An attempt to write ${this.relativeTo(root)} several times!") - - createdFiles[this] = writes + stack - for (call in writes + stack) { - println(call) - } - println() return } -- cgit