You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2016/01/31 19:19:12 UTC

groovy git commit: Groovsh code-completion should display Groovy JDK enhancements for URL, InputStream and OutputStream

Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X 10366b4f5 -> 7fc6977e0


Groovsh code-completion should display Groovy JDK enhancements for URL, InputStream and OutputStream


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/7fc6977e
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/7fc6977e
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/7fc6977e

Branch: refs/heads/GROOVY_2_4_X
Commit: 7fc6977e0b929911e1e10546e186c21b139a3b62
Parents: 10366b4
Author: pascalschumacher <pa...@gmx.net>
Authored: Sun Jan 31 19:18:33 2016 +0100
Committer: pascalschumacher <pa...@gmx.net>
Committed: Sun Jan 31 19:19:00 2016 +0100

----------------------------------------------------------------------
 .../shell/completion/ReflectionCompletor.groovy | 33 ++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/7fc6977e/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ReflectionCompletor.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ReflectionCompletor.groovy b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ReflectionCompletor.groovy
index fa17ae7..001e22d 100644
--- a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ReflectionCompletor.groovy
+++ b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ReflectionCompletor.groovy
@@ -414,7 +414,7 @@ class ReflectionCompletor {
 
     /**
      * Offering all DefaultGroovyMethods on any object is too verbose, hiding all
-     * removes user-friendlyness. So here util methods will be added to candidates
+     * removes user-friendliness. So here util methods will be added to candidates
      * if the instance is of a suitable type.
      * This does not need to be strictly complete, only the most useful functions may appear.
      */
@@ -490,7 +490,7 @@ class ReflectionCompletor {
                     'filterLine(',
                     'getBytes()', 'getText()', 'getText(',
                     'newInputStream()', 'newOutputStream()', 'newPrintWriter()', 'newPrintWriter(', 'newReader()', 'newReader(', 'newWriter()', 'newWriter(',
-                    'readBytes()', 'readLines(', 'renameTo(',
+                    'readBytes()', 'readLines(',
                     'setBytes(', 'setText(', 'size()', 'splitEachLine(',
                     'traverse(',
                     'withInputStream(', 'withOutputStream(', 'withPrintWriter(', 'withReader(', 'withWriter(', 'withWriterAppend(', 'write('
@@ -512,6 +512,35 @@ class ReflectionCompletor {
                     'tokenize(', 'tr('
             ].findAll({it.startsWith(prefix)}).each({candidates.add(it)})
         }
+        if (instance instanceof URL) {
+            [
+                    'eachLine(',
+                    'filterLine(',
+                    'getBytes()', 'getBytes(', 'getText()', 'getText(',
+                    'newInputStream()', 'newInputStream(', 'newReader()', 'newReader(',
+                    'readLines()', 'readLines(',
+                    'splitEachLine(',
+                    'withInputStream(', 'withReader('
+            ].findAll({it.startsWith(prefix)}).each({candidates.add(it)})
+        }
+        if (instance instanceof InputStream) {
+            [
+                    'eachLine(',
+                    'filterLine(',
+                    'getBytes()', 'getText()', 'getText(',
+                    'newReader()', 'newReader(',
+                    'readLines()', 'readLines(',
+                    'splitEachLine(',
+                    'withReader(', 'withStream('
+            ].findAll({it.startsWith(prefix)}).each({candidates.add(it)})
+        }
+        if (instance instanceof OutputStream) {
+            [
+                    'newPrintWriter()', 'newWriter()', 'newWriter(',
+                    'setBytes(',
+                    'withPrintWriter(', 'withStream(', 'withWriter('
+            ].findAll({it.startsWith(prefix)}).each({candidates.add(it)})
+        }
         if (instance instanceof Number) {
             [
                     'abs()',