You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2017/02/01 23:17:53 UTC
[jira] [Closed] (GROOVY-7910) Character objects not found in set
[ https://issues.apache.org/jira/browse/GROOVY-7910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-7910.
-----------------------------
> Character objects not found in set
> ----------------------------------
>
> Key: GROOVY-7910
> URL: https://issues.apache.org/jira/browse/GROOVY-7910
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 2.4.7
> Environment: linux
> Reporter: Jurgen Voorneveld
> Assignee: Jochen Theodorou
>
> ```
> $ groovy --version
> Groovy Version: 2.4.7 JVM: 1.8.0_101 Vendor: Oracle Corporation OS: Linux
> $ cat groovybug.gy
> #!/usr/bin/env groovy
> Set<Character> VOWELS = ['a', 'e', 'o', 'i', 'u']
> def char0 = 'a'
> Character char1 = 'a'
> char char2 = 'a'
> String word = "a"
> def char3 = word.charAt(0)
> println "VOWELS.contains('a'):\t\t\t" + VOWELS.contains('a')
> println "VOWELS.contains(char0):\t\t\t" + VOWELS.contains(char0)
> println "VOWELS.contains(char1):\t\t\t" + VOWELS.contains(char1)
> println "VOWELS.contains(char2):\t\t\t" + VOWELS.contains(char2)
> println "VOWELS.contains(char3):\t\t\t" + VOWELS.contains(char3)
> println "VOWELS.contains(word.charAt(0)):\t" + VOWELS.contains(word.charAt(0))
> println "'a' in VOWELS:\t\t\t\t" + ('a' in VOWELS)
> println "char0 in VOWELS:\t\t\t" + (char0 in VOWELS)
> println "char1 in VOWELS:\t\t\t" + (char1 in VOWELS)
> println "char2 in VOWELS:\t\t\t" + (char2 in VOWELS)
> println "char3 in VOWELS:\t\t\t" + (char3 in VOWELS)
> println "word.charAt(0) in VOWELS:\t\t" + (word.charAt(0) in VOWELS)
> $ ./groovybug.gy
> VOWELS.contains('a'): true
> VOWELS.contains(char0): true
> VOWELS.contains(char1): false
> VOWELS.contains(char2): false
> VOWELS.contains(char3): false
> VOWELS.contains(word.charAt(0)): false
> 'a' in VOWELS: true
> char0 in VOWELS: true
> char1 in VOWELS: false
> char2 in VOWELS: false
> char3 in VOWELS: false
> word.charAt(0) in VOWELS: false
> $
> ```
> Probably something going wrong with the typing
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)