groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jochen Kemnade (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-5769) NullObject leak
Date Thu, 18 May 2017 11:11:04 GMT

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

Jochen Kemnade commented on GROOVY-5769:
----------------------------------------

Fixed in 2.4.6 via GROOVY-6958

> NullObject leak
> ---------------
>
>                 Key: GROOVY-5769
>                 URL: https://issues.apache.org/jira/browse/GROOVY-5769
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>            Reporter: Jochen Theodorou
>
> {code:Java}
> def b = null  
> assert b == null  
> def a = null.getClass().newInstance()  
> println a.getClass() 
> assert a == null
> {code}
> The program shows a leak of NullObject. newInstance will give an instance. This is problematic
in multiple ways. NullObject is supposed to be almost an invisible object, as well as a singleton.
> To make the program above pass we could either fix the compareEquals or we fix newInstance()
to return null for NullObject. I prefer the later one.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message