Code inspection: Convert collection expression with a single 'with()' into object creation
This inspection reports a collection expression that contains a single with(...) element and no other elements. In this case, an object creation expression is clearer because it shows the constructor call directly.
Example
List<int> values = [with(42)];
List<int> values = new(42);
27 October 2026