[
https://issues.apache.org/jira/browse/GROOVY-4526?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jochen Theodorou resolved GROOVY-4526.
--------------------------------------
Fix Version/s: 1.8.0
Assignee: Jochen Theodorou
Resolution: Fixed
the issue got forgotten. The associated PR has been merged 10 years ago already
> 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)