You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/11/03 17:39:00 UTC

[jira] [Closed] (GROOVY-4526) NullObject paradoxes

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

Eric Milles closed GROOVY-4526.
-------------------------------

> NullObject paradoxes
> --------------------
>
>                 Key: GROOVY-4526
>                 URL: https://issues.apache.org/jira/browse/GROOVY-4526
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 1.7.5, 1.8-beta-2
>            Reporter: Nikita Y Volkov
>            Assignee: Jochen Theodorou
>            Priority: Major
>             Fix For: 1.8.0
>
>
> {code}
> def theNull = NullObject.getNullObject()
> assert theNull 	//	first paradox
> assert theNull instanceof NullObject
> assert theNull.equals(null)
> assert theNull != null	//	second paradox
> assert null.getClass() == NullObject
> assert !(null instanceof NullObject)	//	third paradox
> {code}
> I have bumped into this paradox after debugging the following script:
> {code}
> new File('inexestent-folder/').listFiles().with { files ->
> 	assert files
> 	assert files in NullObject
> 	println "This shouldn't happen"
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)