GROOVY-8545: DGM#intersect(Set, Iterable) exception (minor refactor)

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

Branch: refs/heads/GROOVY_2_6_X
Commit: 835c09d9847c847e54b38605ae577a1c4b1e0312
Parents: cd88364
Author: Paul King <pa...@asert.com.au>
Authored: Mon Apr 16 15:34:35 2018 +1000
Committer: Paul King <pa...@asert.com.au>
Committed: Mon Apr 16 15:35:47 2018 +1000

----------------------------------------------------------------------
 .../groovy/tools/shell/completion/ImportsSyntaxCompletor.groovy  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/835c09d9/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ImportsSyntaxCompletor.groovy
----------------------------------------------------------------------
diff --git 
a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ImportsSyntaxCompletor.groovy
 
b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ImportsSyntaxCompletor.groovy
index 67c9b22..19a55df 100644
--- 
a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ImportsSyntaxCompletor.groovy
+++ 
b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ImportsSyntaxCompletor.groovy
@@ -104,13 +104,13 @@ class ImportsSyntaxCompletor implements 
IdentifierCompletor {
                 String className = importSpec.substring(staticPrefix.length(), 
lastDotIndex)
                 Class clazz = shell.interp.evaluate([className]) as Class
                 if (clazz != null) {
-                    List<String> clazzSymbols = 
ReflectionCompletor.getPublicFieldsAndMethods(clazz, '')*.value
+                    Set<String> clazzSymbols = 
ReflectionCompletor.getPublicFieldsAndMethods(clazz, '')*.value
                     Collection<String> importedSymbols
                     if (symbolName == '*') {
                         importedSymbols = clazzSymbols
                     } else {
                         Set<String> acceptableMatches = [symbolName, 
symbolName + '(', symbolName + '()']
-                        importedSymbols = (acceptableMatches as 
Collection).intersect(clazzSymbols)
+                        importedSymbols = 
acceptableMatches.intersect(clazzSymbols)
                     }
                     matches.addAll(importedSymbols)
                 }

Reply via email to