From da713f259444f59a311155d312edf183bc0a98b1 Mon Sep 17 00:00:00 2001 From: tsantalis Date: Fri, 1 Nov 2024 22:10:03 -0400 Subject: [PATCH] Improve actual string generation for composite statements https://github.com/eclipse-jgit/jgit/commit/2fbcba41e365752681f635c706d577e605d3336a#diff-abd82c6e2dd33f06197069caefc17d62b5bdcaa11e7a981cdb13c814df1f9926R1013-R1015 --- .../xmi/decomposition/CompositeStatementObject.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/gr/uom/java/xmi/decomposition/CompositeStatementObject.java b/src/main/java/gr/uom/java/xmi/decomposition/CompositeStatementObject.java index 2da2b9a624..d15ff4ab91 100644 --- a/src/main/java/gr/uom/java/xmi/decomposition/CompositeStatementObject.java +++ b/src/main/java/gr/uom/java/xmi/decomposition/CompositeStatementObject.java @@ -40,8 +40,17 @@ public CompositeStatementObject(CompilationUnit cu, String sourceFolder, String this.actualSignature = whole.substring(0, whole.indexOf("{") + 1); } else { - if(whole.contains("\n")) - this.actualSignature = whole.substring(0, whole.indexOf("\n")); + if(whole.contains("\n")) { + String[] lineArray = whole.split("\\r?\\n"); + int chars = 0; + for(String line : lineArray) { + chars += line.length(); + if(line.endsWith(")")) { + break; + } + } + this.actualSignature = whole.substring(0, chars); + } else this.actualSignature = whole; }