groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7518) hashCode() throws NPE when using @CompileStatic with @EqualsAndHashCode
Date Thu, 23 Jul 2015 08:43:04 GMT

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

ASF GitHub Bot commented on GROOVY-7518:
----------------------------------------

GitHub user paulk-asert opened a pull request:

    https://github.com/apache/incubator-groovy/pull/70

    GROOVY-7518: hashCode() throws NPE when using @CompileStatic with @Eq…

    …ualsAndHashCode

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/paulk-asert/incubator-groovy groovy7518

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-groovy/pull/70.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #70
    
----
commit f4c2a91e81ea239303e1e7541d1a350b7fb80cff
Author: paulk <paulk@asert.com.au>
Date:   2015-07-23T08:41:15Z

    GROOVY-7518: hashCode() throws NPE when using @CompileStatic with @EqualsAndHashCode

----


> hashCode() throws NPE when using @CompileStatic with @EqualsAndHashCode
> -----------------------------------------------------------------------
>
>                 Key: GROOVY-7518
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7518
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.4
>            Reporter: Thomas
>
> Given the following class
> {code:title=Person.groovy}
> import groovy.transform.CompileStatic
> import groovy.transform.EqualsAndHashCode
> @EqualsAndHashCode
> @CompileStatic
> class Person {
> 	Long someLong
> }
> {code}
> and the test
> {code:title=PersonTest.groovy}
> import static org.junit.Assert.*
> import org.junit.Test
> class PersonTest {
> 	@Test
> 	void hashcodeWithoutLongValue() {
> 		def person = new Person()
> 		assert person.hashCode()
> 	}
> }
> {code}
> and the gradle configuration:
> {code:title=build.gradle}
> buildscript {
>     repositories {
>         mavenCentral()
>     }
> }
> apply plugin: 'groovy'
> apply plugin: 'eclipse'
> jar {
>     baseName = 'HashCodeNPE'
>     version = '0.0.1-SNAPSHOT'
> }
> sourceCompatibility = 1.8
> targetCompatibility = 1.8
> repositories {
>     mavenCentral()
> }
> dependencies {
>     compile("org.codehaus.groovy:groovy:2.4.4")
> 	testCompile("junit:junit:4.12")
> }
> eclipse {
>     classpath {
>          containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
>          containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
>     }
> }
> task wrapper(type: Wrapper) {
>     gradleVersion = '2.4'
> }
> {code}
> when I run {code}gradle clean build{code}
> then the test fails with the following message.
> {code}
> PersonTest > hashcodeWithoutLongValue FAILED
>     java.lang.NullPointerException at PersonTest.groovy:10
> 1 test completed, 1 failed
> :test FAILED
> {code}
> With Groovy 2.4.3 the test passes.



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

Mime
View raw message