Collection.toArray() should be passed an array of the proper type
MSALUsing Collection.toArray() without parameters returns an Object[], which requires casting. It is more efficient and clearer to use Collection.toArray(new T[0]) instead. The parameterless form can cause a ClassCastException at runtime when the returned Object[] is cast to a more specific array type.
org. openrewrite. staticanalysis. CollectionToArrayShouldHaveProperTypemod run . --recipe= org. openrewrite. staticanalysis. CollectionToArrayShouldHaveProperTypeInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.