[groovy] branch master updated: Trivial refactoring: remove unnecessarily escaped character

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[groovy] branch master updated: Trivial refactoring: remove unnecessarily escaped character

Daniel.Sun
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new dd83ed8  Trivial refactoring: remove unnecessarily escaped character
dd83ed8 is described below

commit dd83ed81e2c5c22da7a1a0051b5051157bb84b51
Author: Daniel Sun <[hidden email]>
AuthorDate: Sun Dec 1 19:15:49 2019 +0800

    Trivial refactoring: remove unnecessarily escaped character
---
 src/main/java/groovy/ui/GroovyMain.java                        | 2 +-
 src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java   | 2 +-
 src/main/java/org/codehaus/groovy/runtime/MetaClassHelper.java | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/groovy/ui/GroovyMain.java b/src/main/java/groovy/ui/GroovyMain.java
index 1d9ae63..26ff489 100644
--- a/src/main/java/groovy/ui/GroovyMain.java
+++ b/src/main/java/groovy/ui/GroovyMain.java
@@ -195,7 +195,7 @@ public class GroovyMain {
         @Option(names = {"-e"}, paramLabel = "<script>", description = "Specify a command line script")
         private String script;
 
-        @Option(names = {"-i"}, arity = "0..1", paramLabel = "<extension>", description = "Modify files in place; create backup if extension is given (e.g. \'.bak\')")
+        @Option(names = {"-i"}, arity = "0..1", paramLabel = "<extension>", description = "Modify files in place; create backup if extension is given (e.g. '.bak')")
         private String extension;
 
         @Option(names = {"-n"}, description = "Process files line by line using implicit 'line' variable")
diff --git a/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java b/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
index ac8779b..89013bf 100644
--- a/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
+++ b/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
@@ -664,7 +664,7 @@ public class InvokerHelper {
             if (verbose) {
                 String arg = escapeBackslashes((String) arguments)
                         .replaceAll("'", "\\\\'");    // single quotation mark
-                return "\'" + arg + "\'";
+                return "'" + arg + "'";
             } else {
                 return (String) arguments;
             }
diff --git a/src/main/java/org/codehaus/groovy/runtime/MetaClassHelper.java b/src/main/java/org/codehaus/groovy/runtime/MetaClassHelper.java
index f1a8646..55888bd 100644
--- a/src/main/java/org/codehaus/groovy/runtime/MetaClassHelper.java
+++ b/src/main/java/org/codehaus/groovy/runtime/MetaClassHelper.java
@@ -820,7 +820,7 @@ public class MetaClassHelper {
                 value = value.substring(0, MAX_ARG_LEN - 2) + "..";
             }
             if (argument instanceof String) {
-                value = "\'" + value + "\'";
+                value = "'" + value + "'";
             }
         } catch (Exception e) {
             value = shortName(argument);

Apache Groovy committer & PMC member

Blog: http://blog.sunlan.me
Twitter: @daniel_sun