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

Robert Muir commented on LUCENE-6317:
-------------------------------------

{quote}
In Lucene50SegmentInfoFormat.java you can move the Collections.unmodifiableMap 
under the else clause of if (format >= VERSION_SAFE_MAPS) ? Can those other two 
maps be immutable?
{quote}

Yes, thank you!

{quote}
I see new HashMap<>() sometimes and Collections.emptyMap other times.
Is there any way to assert the incoming maps to SI and FI are in fact 
immutable, besides trying to add something to them?
{quote}

That is because these classes (SI/FI) are mutable sometimes (e.g. when created 
by indexwriter), and other times immutable (when read by codec).
This is not a problem I can solve underneath this issue.


> Fix readStringStringMap api
> ---------------------------
>
>                 Key: LUCENE-6317
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6317
>             Project: Lucene - Core
>          Issue Type: Sub-task
>            Reporter: Robert Muir
>             Fix For: Trunk, 5.1
>
>         Attachments: LUCENE-6317.patch, LUCENE-6317.patch, LUCENE-6317.patch
>
>
> Currently this api is not very efficient, and always returns a mutable map.
> Can we change it to allow immutability? its sad we don't return 
> Collections.emptyMap so its the same instance for all empty cases.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to