NightOwl888 commented on issue #648: URL: https://github.com/apache/lucenenet/issues/648#issuecomment-1285279996
@nikcio Here is a puzzle to work out. The scan is telling us [to use an immutable collection](https://sonarcloud.io/project/issues?issues=AYPAuPMthbfJOGLOoa9e&open=AYPAuPMthbfJOGLOoa9e&id=nikcio_lucenenet). The problem is, this is an immutable collection, just not one from `System.Collection.Immutable`. Those collections have very different behaviors than what is expected in Lucene, so we also made additional read-only collections in J2N to behave like the ones in Java. Here are a list of all of our immutable collections. 1. `CharArraySet` (after calling `CharArraySet.UnmodifiableSet()`). This just makes a regular `CharArraySet` instance that is backed by a `CharArrayMap.UnmodifiableCharArrayMap<TValue>`. 2. `CharArrayMap.UnmodifiableCharArrayMap<TValue>` 3. `J2N.Collections.ObjectModel.ReadOnlyCollection<T>` 4. `J2N.Collections.ObjectModel.ReadOnlyDictionary<TKey, TValue>` 5. `J2N.Collections.ObjectModel.ReadOnlyList<T>` 6. `J2N.Collections.ObjectModel.ReadOnlySet<T>` So we need to adjust the scan to ignore these, while picking up any others that we might have missed. Since there are only a few dozen, we could suppress them with an attribute, but since this isn't a Roslyn error, I am not sure how to suppress it conditionally. Thoughts? One other issue is the fact that J2N [currently doesn't support `ImmutableArray<T>`](https://github.com/NightOwl888/J2N/issues/42) for structural equality comparisons (we assumed that Microsoft would never create a struct collection, and then they made this one), so ideally we wouldn't return it from any of our public APIs just yet. We want to fix this eventually, but mark these issues with a `LUCENENET TODO: Change to ImmutableArray<T> when structural equality support for it is added in J2N` and suppress it from the scan. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
