[jira] [Commented] (GROOVY-7834) Calling hashCode on IntRange iterates through all elements in the range.

2016-08-18 Thread Anand (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7834?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15427674#comment-15427674
 ] 

Anand commented on GROOVY-7834:
---

I am taking only lower and upper bound to generate hash code. Pairing function 
grantees the output no to be deterministic. Have look at the pull request and 
let me know

> Calling hashCode on IntRange iterates through all elements in the range.
> 
>
> Key: GROOVY-7834
> URL: https://issues.apache.org/jira/browse/GROOVY-7834
> Project: Groovy
>  Issue Type: Bug
>Reporter: howard zhang
>
> {code}
> new IntRange(0, Integer.MAX_VALUE-1).hashCode()
> {code}
> The above code takes a few seconds to complete.
> I believe the hashCode method is not overridden and it defaults to 
> AbstractList which iterates through all elements.  I don't think this should 
> be the default behavior.
> http://grepcode.com/file_/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/AbstractList.java/?v=source



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (GROOVY-7883) Static compiler prefers private constructor over public if private matches better

2016-08-17 Thread Anand (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15424245#comment-15424245
 ] 

Anand commented on GROOVY-7883:
---

I believe this is how java compiler works. There is matching argument 
constructor  available but  restricted through access modifier. By adding 
compileSatic groovy just bypass the meta object protocol and the compilation is 
done in very regular java way. I think this compileStatic is doing correctly. 
One way to test is convert this into java and then try to compile using javac. 
I get the same error.

> Static compiler prefers private constructor over public if private matches 
> better
> -
>
> Key: GROOVY-7883
> URL: https://issues.apache.org/jira/browse/GROOVY-7883
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.4.7
>Reporter: Jason Winnebeck
>
> When constructing an AssertionError for example, it has a public constructor 
> taking Object and a private constructor taking String. The static compiler 
> "chooses" the private constructor over the public one and this results in a 
> compile error.
> {code}
> @groovy.transform.CompileStatic
> void doIt() {
>   //Cannot call private constructor for java.lang.AssertionError. However, it 
> should call AssertionError(Object)
>   throw new AssertionError("abc")
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (GROOVY-7908) groovy default list.find == item is giving false even if the item is present

2016-08-16 Thread Anand (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15422669#comment-15422669
 ] 

Anand commented on GROOVY-7908:
---

Closing found out this is not a bug. list.find() returns first truth value. 

> groovy default list.find == item  is giving false even if the item is present
> -
>
> Key: GROOVY-7908
> URL: https://issues.apache.org/jira/browse/GROOVY-7908
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-jdk
>Affects Versions: 2.4.7
> Environment: Ubuntu 16.04
>Reporter: Anand
>Priority: Minor
>
> For the following script,
> {code} def names = []
> names << "Anand"
> names << "Aditya"
> names << "Abhi"
> def searchItem = "bug"
> if (names.find() == searchItem)
> println "item found "
> else
> println "Item not found "
> println "adding the Item"
> names << searchItem
> println "Item added"
> println "values: $names"
> println "trying again"
> if (names.find() == searchItem)
> println "Item found "
> else
> println "Item still not found "  {code}
> In list there first the search item is not present and it has yielded false 
> but then i added the item and still find method is giving false. The opposite 
> case work well i.e if initially item is there it gives true and then if i 
> remove it then it gives false.
> Is it how it is designed to work or is this a bug.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Closed] (GROOVY-7908) groovy default list.find == item is giving false even if the item is present

2016-08-16 Thread Anand (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-7908?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Anand closed GROOVY-7908.
-
Resolution: Not A Bug

> groovy default list.find == item  is giving false even if the item is present
> -
>
> Key: GROOVY-7908
> URL: https://issues.apache.org/jira/browse/GROOVY-7908
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-jdk
>Affects Versions: 2.4.7
> Environment: Ubuntu 16.04
>Reporter: Anand
>Priority: Minor
>
> For the following script,
> {code} def names = []
> names << "Anand"
> names << "Aditya"
> names << "Abhi"
> def searchItem = "bug"
> if (names.find() == searchItem)
> println "item found "
> else
> println "Item not found "
> println "adding the Item"
> names << searchItem
> println "Item added"
> println "values: $names"
> println "trying again"
> if (names.find() == searchItem)
> println "Item found "
> else
> println "Item still not found "  {code}
> In list there first the search item is not present and it has yielded false 
> but then i added the item and still find method is giving false. The opposite 
> case work well i.e if initially item is there it gives true and then if i 
> remove it then it gives false.
> Is it how it is designed to work or is this a bug.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (GROOVY-7908) groovy default list.find == item is giving false even if the item is present

2016-08-16 Thread Anand (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15422565#comment-15422565
 ] 

Anand commented on GROOVY-7908:
---

i was in a state of mind that doing list.find() == item would give me true even 
 if the item is present at any position. Is my understanding correct ? if NO 
then my Bad this is not a bug. But if yes then in the line  names << searchItem 
in the code i have added
the searchItem to the list but still names.find() == searchItem is giving me 
false.

It cannot be searchItem if it is no in the list, still it returns something... 
so what is it?

names.find() is returning the first item  in the list.


> groovy default list.find == item  is giving false even if the item is present
> -
>
> Key: GROOVY-7908
> URL: https://issues.apache.org/jira/browse/GROOVY-7908
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-jdk
>Affects Versions: 2.4.7
> Environment: Ubuntu 16.04
>Reporter: Anand
>Priority: Minor
>
> For the following script,
> {code} def names = []
> names << "Anand"
> names << "Aditya"
> names << "Abhi"
> def searchItem = "bug"
> if (names.find() == searchItem)
> println "item found "
> else
> println "Item not found "
> println "adding the Item"
> names << searchItem
> println "Item added"
> println "values: $names"
> println "trying again"
> if (names.find() == searchItem)
> println "Item found "
> else
> println "Item still not found "  {code}
> In list there first the search item is not present and it has yielded false 
> but then i added the item and still find method is giving false. The opposite 
> case work well i.e if initially item is there it gives true and then if i 
> remove it then it gives false.
> Is it how it is designed to work or is this a bug.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (GROOVY-7908) groovy default list.find == item is giving false even if the item is present

2016-08-16 Thread Anand (JIRA)
Anand created GROOVY-7908:
-

 Summary: groovy default list.find == item  is giving false even if 
the item is present
 Key: GROOVY-7908
 URL: https://issues.apache.org/jira/browse/GROOVY-7908
 Project: Groovy
  Issue Type: Bug
  Components: groovy-jdk
Affects Versions: 2.4.7
 Environment: Ubuntu 16.04
Reporter: Anand
Priority: Minor


For the following script,
{code} def names = []
names << "Anand"
names << "Aditya"
names << "Abhi"

def searchItem = "bug"

if (names.find() == searchItem)
println "item found "
else
println "Item not found "

println "adding the Item"

names << searchItem

println "Item added"
println "values: $names"
println "trying again"

if (names.find() == searchItem)
println "Item found "
else
println "Item still not found "  {code}

In list there first the search item is not present and it has yielded false but 
then i added the item and still find method is giving false. The opposite case 
work well i.e if initially item is there it gives true and then if i remove it 
then it gives false.
Is it how it is designed to work or is this a bug.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)